function restore(id, image) {
  var imagesrc = "../images/" + image; 
  document.getElementById(id).src = imagesrc;
}

function swapImage(id, image) { 
  var imagesrc = "../images/" + image; 
  document.getElementById(id).src = imagesrc;
}

function cleartext() {	
	if(document.getElementById("txtSearch").value == "Search by title, author or ISBN")
	{
	  document.getElementById("txtSearch").value = "";
	}
} 

function ChapOverLay_Show(prod) {
	document.getElementById("overlay_PrdDetail").style.display = "block";
	document.getElementById("chapter_overlay_PrdDetail").style.display = "block";
	document.getElementById(prod).style.display = "block";
	var divs = document.getElementById(prod).getElementsByTagName("div");
	for(i = 0; i < divs.length; i++){
		divs[i].style.display = "block";
	}
}

function ChapOverLay_Show_Microsite(prod) {
	document.getElementById(prod).style.display = "block";
	var divs = document.getElementById(prod).getElementsByTagName("div");
	for(i = 0; i < divs.length; i++){
		divs[i].style.display = "block";
	}
}

function ChapOverLay_Hide_Microsite(prod) {
	document.getElementById(prod).style.display = "none";
	var divs = document.getElementById(prod).getElementsByTagName("div");
	for(i = 0; i < divs.length; i++){
		divs[i].style.display = "none";
	}
}


function loginOverLay_Show() {
	document.getElementById("overlay").style.display = "block";
	document.getElementById("login_overlay").style.display = "block";
	document.getElementById("loginwidget").style.display = "block";
	document.getElementById("userLogin").focus();
	//Added by Ying--Start
	select_hide(1);
	//Added by Ying--end
}


function loginOverLay_hide() {
	document.getElementById("login_overlay").style.display = "none";	
	document.getElementById("loginwidget").style.display = "none";
	document.getElementById("overlay").style.display = "none";
	//Added by Ying--Start
	select_hide(0);
	//Added by Ying--end
}

//Added by Ying--Start
function select_hide(a){
	var g, h=(a==1)?"hidden":"visible";
	if (document.getElementById) {
		g=document.getElementById("PageSize");
		if(g){
			g.style.visibility = h;
		}
	}
}
//Added by Ying--end	

function ChapOverLay_hide() {	
	var divs = document.getElementById("overlay_PrdDetail").getElementsByTagName("div");
	for(i = 0; i < divs.length; i++){
		divs[i].style.display = "none";
	}
	document.getElementById("overlay_PrdDetail").style.display = "none";	
}

function ShowPopUp(pageURL,id,w,h){
	var cvn = null;
	LeftPosition = (screen.width) ? (screen.width-w)/2 : 0;
	TopPosition = (screen.height) ? (screen.height-h)/2 : 0;
	settings = 'height='+h+',width='+w+',top='+TopPosition+',left='+LeftPosition+', resizable=0, statusbar=0, toolbar=0,scrollbars=0,location=0'
	cvn = window.open(pageURL,id,settings)
}

function PopWin(pageURL,id,w,h){
	var cvn = null;
	LeftPosition = (screen.width) ? (screen.width-w)/2 : 0;
	TopPosition = (screen.height) ? (screen.height-h)/2 : 0;
	settings = 'height='+h+',width='+w+',top='+TopPosition+',left='+LeftPosition+', resizable=0, statusbar=0, toolbar=0,scrollbars=1,location=0'
	cvn = window.open(pageURL,id,settings);	
	cvn.focus();
}

function SameEnable(objName1) {
		var obj1 = this.document.getElementById(objName1);
		obj1.setAttribute('disabled', false);  
}
function SameDisable(objName1, objName2) {
		var obj1 = this.document.getElementById(objName1);
		var obj2 = this.document.getElementById(objName2);
		obj1.value = obj2.value;
		obj1.setAttribute('disabled', true);  
}
function SameShipping(objName) { //v6.0
		var obj = this.document.getElementById(objName);
		if (obj.checked==true){
				SameDisable("shipadd1", "billadd1");
				SameDisable("shipadd2", "billadd2");
				SameDisable("shipcity", "billcity");
				SameDisable("shipcounty", "billcounty");
				SameDisable("shipzip", "billzip");
				SameDisable("shipcountry", "billcountry");
				SameDisable("shiptel", "billtel");
				SameDisable("shipfax", "billfax");
				SameDisable("shipemail", "billemail");
				//this.document.frmBrowse.shipemail.value = this.document.frmBrowse.billemail.value;
		}
		else
		{
				SameEnable("shipadd1");
				SameEnable("shipadd2");
				SameEnable("shipcity");
				SameEnable("shipcounty");
				SameEnable("shipzip");
				SameEnable("shipcountry");
				SameEnable("shiptel");
				SameEnable("shipfax");
				SameEnable("shipemail");
		}
}
function MatchHeight(obj1, obj2) {
  var objOne = this.document.getElementById(obj1);
		var objTwo = this.document.getElementById(obj2);
		
		if(objTwo.offsetHeight > objOne.offsetHeight){ 
			objOne.style.height = objTwo.offsetHeight;
  } 
}
var show = 1;
var hide = 0;

 function toggleBox(szDivID, iState) { // 1 visible, 0 hidden
	var footerName  = document.getElementById('footerWrapper'); // Fix for Sticky Footer 
    if(document.layers) {	   //NN4+
       var style2 = document.layers[szDivID].style;
       style2.display = iState ? "block":"";
    } else if(document.getElementById) {  //gecko(NN6) + IE 5+
      var style2 = document.getElementById(szDivID).style;
      style2.display = iState ? "block":"";
      footerName.style.zIndex = iState ? "-1":"1";
    } else if(document.all) {	// IE 4
      var style2 = document.all[szDivID].style;
      style2.display = iState ? "block":"";
    }
  }
  
  function toggleEmail() {
    if (document.forms["registerForm"].useTextMgrEmail.checked) {
      document.forms["registerForm"].remittanceEmail.value = document.forms["registerForm"].textMgrEmail.value;
    } else {
      document.forms["registerForm"].remittanceEmail.value = "";
    }
  }

  function openWindow(theVAR, theCust) {
    document.domain = "cengage.com";
    popupWin = window.open('/db2www/listab.mac/listAB?StoreID=SOLO&Field='+theVAR+'&AN8='+theCust+'&website=sp&FormName=registerForm&ShowVendors=YY', 'remote', 'status,scrollbars,width=440,height=400,left=10,top=10')
  }