////////////////////////
	function GetXmlHttpObject(){
		var xmlHttp=null;
		try
		 { // Firefox, Opera 8.0+, Safari
			 xmlHttp=new XMLHttpRequest();
		 }
		catch (e)
		 { //Internet Explorer
			 try
			  { xmlHttp=new ActiveXObject("Msxml2.XMLHTTP");}
			 catch (e)
			  { xmlHttp=new ActiveXObject("Microsoft.XMLHTTP"); }
		 }
		return xmlHttp;
	} 
////////////////////////

function toggle(divId,state,display) // 1 visible, 0 hidden
{
    if(document.layers){//NN4+
    	
        document.layers[divId].visibility=state?"show":"hide";
        
    }else if(document.getElementById){	  //gecko(NN6) + IE 5+
    	
        var obj = document.getElementById(divId);
        obj.style.visibility=state?"visible":"hidden";
        
        if(display=='wow'){
		    var pathBase=document.getElementById("hidPathBase").value;
            document.getElementById("ts_image").innerHTML="<a id=\"tslink\" href=\"javascript:popImage('"+pathBase+"/img/ts1.jpg','Seven Continents');\"><img name=\"show\" src=\"/img/ts1_thumb.jpg\" style=\"border-style: none;\"></a>";   
            document.getElementById("ts_next").innerHTML="<a href=\"#\" onClick=\"next('wow',11);\">";
            document.getElementById("ts_prev").innerHTML="<a href=\"#\" onClick=\"previous('wow',11);\">";
			document.getElementById("ts_msg").innerHTML="<span style=\"height:300px; \"></span>";
        }
        
    } else if(document.all){	// IE 4 
        document.all[divId].style.visibility=state?"visible":"hidden";
    }
}

function setAllToggle(state)
{	
	toggle('quiz',state);
	toggle('qualify', state);
	toggle('checkbox0',state);
	toggle('checkbox1',state);
	toggle('checkbox2',state);
	toggle('checkbox3',state);
	toggle('checkbox4',state);
	toggle('checkbox5',state);
	toggle('checkbox6',state);

	document.getElementById('divPopup').style.visibility = 'hidden'; 
}
if (document.images) {

    barbutton1up       = new Image();
    barbutton1up.src   = "/img/bar_code.gif" ;
    barbutton1down     = new Image() ;
    barbutton1down.src = "/img/bar_code_1.gif" ;
    
    barbutton2up       = new Image();
    barbutton2up.src   = "/img/bar_code.gif" ;
    barbutton2down     = new Image() ;
    barbutton2down.src = "/img/bar_code_2.gif" ;
    
    barbutton3up       = new Image();
    barbutton3up.src   = "/img/bar_code.gif" ;
    barbutton3down     = new Image() ;
    barbutton3down.src = "/img/bar_code_3.gif" ;
    
    barbutton4up       = new Image();
    barbutton4up.src   = "/img/bar_code.gif" ;
    barbutton4down     = new Image() ;
    barbutton4down.src = "/img/bar_code_4.gif" ;
    
    barbutton5up       = new Image();
    barbutton5up.src   = "/img/bar_code.gif" ;
    barbutton5down     = new Image() ;
    barbutton5down.src = "/img/bar_code_5.gif" ;
    
    barbutton6up       = new Image();
    barbutton6up.src   = "/img/bar_code.gif" ;
    barbutton6down     = new Image() ;
    barbutton6down.src = "/img/bar_code_6.gif" ;
    
    barbutton7up       = new Image();
    barbutton7up.src   = "/img/bar_code.gif" ;
    barbutton7down     = new Image() ;
    barbutton7down.src = "/img/bar_code_7.gif" ;
    
}

function isChecked()
{
	for(i=0; i<7; i++)
	{
		if( isVisible('checkbox'+ i)) { return true; }
	}
	return false;
}

function isVisible(divId)
{
	if(document.layers)	   //NN4+
    {
       if(document.layers[divId].visibility == "show"){return true; }
    }
	else if(document.getElementById)	  //gecko(NN6) + IE 5+
    {
        var obj = document.getElementById(divId);
        if( obj.style.visibility == "visible"){return true;}
    }
    else if(document.all)	// IE 4
    {
        if(document.all[divId].style.visibility == "visible"){return true;}
    }
	
	return false;
}


/// POP Image ///
// Set the horizontal and vertical position for the popup
PositionX = 50;
PositionY = 50;

// Set these value approximately 20 pixels greater than the
// size of the largest image to be used (needed for Netscape)
defaultWidth  = 970;
defaultHeight = 710;

// Set autoclose true to have the window close automatically
// Set autoclose false to allow multiple popup windows

var AutoClose = true;

// Do not edit below this line...
// ================================
if (parseInt(navigator.appVersion.charAt(0))>=4){
var isNN=(navigator.appName=="Netscape")?1:0;
var isIE=(navigator.appName.indexOf("Microsoft")!=-1)?1:0;}
var optNN='scrollbars=yes,width='+defaultWidth+',height='+defaultHeight+',left='+PositionX+',top='+PositionY;
var optIE='scrollbars=yes,width=150,height=100,left='+PositionX+',top='+PositionY;


function popImage(imageURL,imageTitle){
  if (isNN){imgWin=window.open(imageURL,'',optNN);}
  if (isIE){imgWin=window.open(imageURL,'',optIE);}
  with (imgWin.document){
  writeln('<html><head><title>"+imageTitle+"</title><style>body{margin:0px;}</style>');writeln('<sc'+'ript>');
  writeln('var isNN,isIE;');writeln('if (parseInt(navigator.appVersion.charAt(0))>=4){');
  writeln('isNN=(navigator.appName=="Netscape")?1:0;');writeln('isIE=(navigator.appName.indexOf("Microsoft")!=-1)?1:0;}');
  writeln('function reSizeToImage(){');writeln('if (isIE){');writeln('window.resizeTo(100,100);');
  writeln('width=document.images[0].width+40;');
  writeln('height=document.images[0].height+60;');
  writeln('window.resizeTo(width,height);}');writeln('if (isNN){');       
  writeln('window.innerWidth=document.images[0].width;');writeln('window.innerHeight=document.images[0].height;}}');
  writeln('function doTitle(){document.title="'+imageTitle+'";}');writeln('</sc'+'ript>');
  if (!AutoClose) writeln('</head><body bgcolor=FFFFFF scroll="yes" onload="reSizeToImage();doTitle();self.focus()">')
  else writeln('</head><body bgcolor=FFFFFF scroll="yes" onload="reSizeToImage();doTitle();self.focus()" onblur="self.close()">');
  writeln('<img name="SevenContinents" src='+imageURL+' style="display:block"></body></html>');
  close();		
  }
}

function fbarbutton1down(buttonname)
{
    if (document.images) {
      document[ buttonname ].src = eval( buttonname + "1down.src" );
    }
}
function fbarbutton1up (buttonname)
{
    if (document.images) {
      document[ buttonname ].src = eval( buttonname + "1up.src" );
    }
}

function fbarbutton2down(buttonname)
{
    if (document.images) {
      document[ buttonname ].src = eval( buttonname + "2down.src" );
    }
}
function fbarbutton2up (buttonname)
{
    if (document.images) {
      document[ buttonname ].src = eval( buttonname + "2up.src" );
    }
}

function fbarbutton3down(buttonname)
{
    if (document.images) {
      document[buttonname].src = eval( buttonname + "3down.src" );
    }
}
function fbarbutton3up (buttonname)
{
    if (document.images) {
      document[buttonname].src = eval( buttonname + "3up.src" );
    }
}

function fbarbutton4down(buttonname)
{
    if (document.images) {
      document[buttonname].src = eval( buttonname + "4down.src" );
    }
}
function fbarbutton4up (buttonname)
{
    if (document.images) {
      document[buttonname].src = eval( buttonname + "4up.src" );
    }
}

function fbarbutton5down(buttonname)
{
    if (document.images) {
      document[buttonname].src = eval( buttonname + "5down.src" );
    }
}
function fbarbutton5up (buttonname)
{
    if (document.images) {
      document[buttonname].src = eval(buttonname + "5up.src" );
    }
}

function fbarbutton6down(buttonname)
{
    if (document.images) {
      document[buttonname].src = eval(buttonname + "6down.src" );
    }
}
function fbarbutton6up (buttonname)
{
    if (document.images) {
      document[buttonname].src = eval(buttonname + "6up.src" );
    }
}

function fbarbutton7down(buttonname)
{
    if (document.images) {
      document[buttonname].src = eval(buttonname + "7down.src");
    }
}
function fbarbutton7up (buttonname)
{
    if (document.images) {
      document[buttonname].src = eval(buttonname + "7up.src");
    }
}
/// END POP Image ///
function next(display, numImages) 
{
    var pathBase=document.getElementById("hidPathBase").value;
	if( current + 1 > numImages )	{ 	current = 1;			}
	else							{	current = current + 1;	}
    if(display=='wow')
    {
	    document.images.show.src = document.slideformWow.slide[current - 1].value;
	    jsline = "javascript:popImage('"+pathBase+"/img/ts" + current + ".jpg','Seven Continents');";
	}
    else
    {
        document.images.show.src = document.slideformRetail.slide[current - 1].value;
        jsline = "javascript:popImage('"+pathBase+"/img/retaildet" + current + ".jpg','Seven Continents');";    
    }
    if (document.links.length > 0) {
		if (document.getElementById) {
			document.getElementById("tslink").href = jsline;
		}
	}
	return false;
}
function previous(display,numImages) 
{
    var pathBase=document.getElementById("hidPathBase").value;
	if(current - 1 == 0)	{ 	current = numImages;	}
	else					{	current = current - 1;	}
	
	//document.images.show.src = document.slideform.slide[current - 1].value;
	//jsline = "javascript:popImage('img/ts" + current + ".jpg','Seven Continents');";
	if(display=='wow')
    {
        document.images.show.src = document.slideformWow.slide[current - 1].value;
        jsline = "javascript:popImage('"+pathBase+"/img/ts" + current + ".jpg','Seven Continents');";
    }
    else
    {
        document.images.show.src = document.slideformRetail.slide[current - 1].value;
        jsline = "javascript:popImage('"+pathBase+"/img/retaildet" + current + ".jpg','Seven Continents');";    
    }
    if (document.links.length > 0) {
		if (document.getElementById) {
			document.getElementById("tslink").href = jsline;
		}
	}
	return false;
}

	function showDivModalQuiz(url) { 
		url=url+"/"+new Date().getTime();
		var xmlHttpPopUp=GetXmlHttpObject();
		if (xmlHttpPopUp==null){
			 alert ("Browser does not support HTTP Request");
			 return;
		 }
		 
		var div = document.getElementById('divPopup');
		var content = document.getElementById('divContentQuiz');
		xmlHttpPopUp.onreadystatechange=function(){
		
			if (xmlHttpPopUp.readyState==4 || xmlHttpPopUp.readyState=="complete"){ 	
				if(xmlHttpPopUp.responseText.match("session_expired")){ 
					 alert(expireTxt);
				     window.location=folderPathUser+"login";
				} else {
					content.innerHTML=xmlHttpPopUp.responseText;
					div.style.visibility = 'visible'; 
				}
			} 
		};

		xmlHttpPopUp.open("GET",url,true);
		xmlHttpPopUp.send(null);
	}
	
function getImgSize(imgSrc)
{
	var newImg = new Image();
	newImg.src = imgSrc;
	var height = newImg.height;
	var width = newImg.width;
	alert ('The image size is '+width+'*'+height);
}

function pop_img_barcode(url) {
	var height=550;
	var width=500;
	var newwindow;
	
    x = (640 - width)/2, y = (480 - height)/2;
 
    if (screen) {
        y = (screen.availHeight - height)/2;
        x = (screen.availWidth - width)/2;
    }
	window.open(url,'newWindow','scrollbars=yes,width='+width+',height='+height+',screenX='+x+',screenY='+y+',top='+y+',left='+x);
}

function pop_img_barcode_show(divID){
    document.getElementById(divID).style.display="block";
	document.getElementById('click7').href="#";
	document.getElementById('click6').href="#";
	document.getElementById('click5').href="#";
	document.getElementById('click4').href="#";
	document.getElementById('click3').href="#";
	document.getElementById('click2').href="#";
	document.getElementById('click1').href="#";
}
function pop_img_barcode_hide(divID){
    document.getElementById(divID).style.display="none";
	document.getElementById('click7').href="javascript:pop_img_barcode_show('imageNum7');";
	document.getElementById('click6').href="javascript:pop_img_barcode_show('imageNum6');";
	document.getElementById('click5').href="javascript:pop_img_barcode_show('imageNum5');";
	document.getElementById('click4').href="javascript:pop_img_barcode_show('imageNum4');";
	document.getElementById('click3').href="javascript:pop_img_barcode_show('imageNum3');";
	document.getElementById('click2').href="javascript:pop_img_barcode_show('imageNum2');";
	document.getElementById('click1').href="javascript:pop_img_barcode_show('imageNum1');";
}
