// JavaScript Document
function mywin(page)
{
window.open(page,'','width=750,height=500 scroll=no');
}
function notcomplete()
{
 alert("Unfortunately this function is not yet activated");
 }
function notcomplete2()
{
 alert("Unfortunately this function is not yet activated");
 return false;}
/////////////////////////////////////////////
function ismail()
{
 var pos;
 var pos2;
 var s=document.form1.email.value;
 if(s == "")
 {
	alert("Please Enter a valid e-mail address");
	document.form1.email.focus();
	return false;
 }
 pos = s.indexOf('@',1);
 if((pos == -1) || (pos == (s.length-1)))
 {
	alert("Please Enter a valid e-mail address");
	document.form1.email.focus();
	return false;
 }
 pos2 = s.indexOf('.',1);
 if((pos2 == -1) || (pos2 == (s.length-1)))
 {
	alert("Please Enter a valid e-mail address");
	document.form1.email.focus();
	return false;
 }
 return true;
}
///////////////////////////////isempty function//////////////////////

var whitespace="\t\n\r";

function isEmpty(s)
{
  var i;

     if((s==null) || (s.length==0))
     	return true;

        for(i=0;i<s.length;i++)
          {
            var c=s.charAt(i);

            if(whitespace.indexOf(c)==-1)
            return false;
          }
     return true;
}
/////////////////////////////framing with static input height//////////////////////

function loadpagecontent(mytag,page,height){
	var content=document.getElementById(mytag);
	content.src=page;
	content.height=height;
	//content.innerHTML="<iframe id='mainframe' src='"+page+"' width='"+width+"' height='"+height+"' scrolling='no' frameborder='0' class='frame_bground' name='footer'></iframe>";
}

/////////////////////////////////getting http parameter///////////////////////
function GetParam(name)
{
  var start=location.search.indexOf("?"+name+"=");
  if (start<0) start=location.search.indexOf("&"+name+"=");
  if (start<0) return '';
  start += name.length+2;
  var end=location.search.indexOf("&",start)-1;
  if (end<0) end=location.search.length;
  var result='';
  for(var i=start;i<=end;i++) {
    var c=location.search.charAt(i);
    result=result+(c=='+'?' ':c);
  }
  return unescape(result);
}

//////////////////////////// reading default image on that appear on the page//////////////

function gallery()
{
   var imagename=GetParam('image');
   var system=GetParam('sys');
   var type=GetParam('type');
   allimg=GetParam('ImgNum');
   //alert(imagename);
   var ImageChange=document.getElementById("im");
  //alert(ImageChange);
   var source="images/"+system+"/"+type+"/"+imagename+".jpg";
   ImageChange.src=source;
}

function mygallery(page)
{
window.open(page,'','width=778,height=620,scroll=no');
}
///////////////////////////////////////image gallery next and previuos/////////////////////////////
current=GetParam('image')-1;/////getting parameters
allimg=GetParam('ImgNum');
system=GetParam('sys');
type=GetParam('type');

var value=1;
var x=new Array;
for(var k=0;k<allimg;k++)
{
   x[k]=value;
   value++;

}

function next() 
{
    
	 if(x[current]==allimg)
     {
     alert('End of Images Click Pervious to Go Back');
   
     }
     else if(x[current]<allimg){
      
     
  
    /*if (!document.images[x[current+1]+".jpg"].complete)
        {
              var content=document.getElementById("load");
	          content.innerHTML="<img src='images/loading.gif' id='im' name='show'>";
           //document.images.show.src=("images/loading.gif");
            
        } 
     ///alert(document.images[x[1]+".jpg"].complete);*/     
     document.images.show.src =("images/"+system+"/"+type+"/"+x[current+1]+".jpg");
     var Online_Image=document.getElementById("now");
	 Online_Image.innerHTML=x[current+1];
	 current++;
     }
 
}
//////////////////////////////////////////////////////////////////
function prev() 
{

   if(x[current]==1)
   {
   alert('End of Images Click Next to Go Forward');
    }
    else if(x[current]>1)
    {
   document.images.show.src =("images/"+system+"/"+type+"/"+x[current-1]+".jpg");
   var Online_Image=document.getElementById("now");
   Online_Image.innerHTML=x[current-1];
   current--;
    }

}
///////////////////////////trial////////////////////////

var timer = null;
var images = new Array();

function init(){
    images[0] = new Image();
    images[0].src = "images/global_sys/3d/1.jpg";
    images[1] = new Image();
    images[1].src = "images/global_sys/3d/2.jpg";
    images[2] = new Image();
    images[2].src = "images/global_sys/3d/3.jpg";
   
timer = setInterval(check(), 10);

//document.images.show.src=images[1].src ;  
//document.images.show.src=images[2].src ; 
return;

}
function check(){
    for(var i = 0; i < images.length; i++){
        if(!images[i].complete){ alert("complete");
           
           document.images.show.src="images/global_sys/3d/1.jpg"; 
}
              
}
    clearInterval(timer);
    images = null;
    //return;
}
