var popup;
function open_terms_popup(lang,base_link)
{
	if(popup)
	{
		popup.close();
	}
	popup=window.open(base_link+'/Terms_and_Policy_'+lang+'.htm','','width=470,height=600,scrollbars=yes');
}

function productPreview()
{
document.cart_quantity.langChange.value = document.cart_quantity.language.value;
document.cart_quantity.submit();
}

function preview_change_image(hero,td)

{

        if(document.getElementById('product_image'))
	{
	var doc_img = document.getElementById('product_image');

	doc_img.src = "../images/"+hero;
	}
   	if(document.getElementById(td))
	{
		document.getElementById(td).style.visibility="visible";
	}
	for(i=1;i<=15;i++)
	{
		var old_td = "td"+i;
		if(old_td != td)
		{
			if(document.getElementById(old_td))
			{
				document.getElementById(old_td).style.visibility="hidden";
			}
		}
	}
}

function change_image(hero,td)
{
        if(document.getElementById('product_image'))
	{
		var doc_img = document.getElementById('product_image');

		doc_img.src = "images/"+hero;
	}
   	if(document.getElementById(td))
	{
		document.getElementById(td).style.visibility="visible";
	}
	for(i=1;i<=15;i++)
	{
		var old_td = "td"+i;
		if(old_td != td)
		{
			if(document.getElementById(old_td))
			{
				document.getElementById(old_td).style.visibility="hidden";
			}
		}
	}

}

function build_change_image(hero,td,zoom)
{
	//Changed the function variables and added code to assign values for zoom image. By Vishu for Enhancement 2009
        if(document.getElementById('pd_zoom'))
        {
		document.getElementById('pd_zoom').href="";
		document.getElementById('pd_zoom').href=zoom;
        }
	if(document.getElementById('product_image'))
	{
		var doc_img = document.getElementById('product_image');

		doc_img.src = hero;
	}
   	if(document.getElementById(td))
	{
		document.getElementById(td).style.visibility="visible";
	}
	for(i=1;i<=15;i++)
	{
		var old_td = "td"+i;
		if(old_td != td)
		{
			if(document.getElementById(old_td))
			{
				document.getElementById(old_td).style.visibility="hidden";
			}
		}
	}
}

//Added by pandiarajan for checking shopping cart location and division starts
function checklocation(session_id)
{
//var page = document.cart_quantity.page_name.value;
//var osCsid = document.cart_quantity.osCsid.value;
var division = document.cart_quantity.division.value;
var location = document.cart_quantity.location.value;
var cartSize = document.cart_quantity.shoppingCartSize.value;
var shoppingLoc = document.cart_quantity.shoppingCartLoc.value;
var shoppingDiv = document.cart_quantity.shoppingCartDiv.value;
var navLoc = document.cart_quantity.location.value;
var navDiv = document.cart_quantity.division.value;
if(cartSize == 0)
{
shoppingLoc = navLoc;
shoppingDiv = navDiv;
//document.cart_quantity.action = '/product&shoppingLoc='+shoppingLoc+'&shoppingDiv='+shoppingDiv+session_id;
document.cart_quantity.submit();
}
else
{
if((shoppingLoc != navLoc)&&(shoppingDiv = navDiv))
{
//alert(session_id);
//included

width = screen.width;
height = screen.height;


		  var myWidth = 0, myHeight = 0;
		  if( typeof( window.innerWidth ) == 'number' )
		  {
			//Non-IE
			myWidth = window.innerWidth;
			myHeight = window.innerHeight;

			document.getElementById("confirmlayer").style.top = (myHeight/2)-50 + "px";
			document.getElementById("confirmlayer").style.left = (myWidth/2)-140 + "px";



		  }
		  else if( document.documentElement && ( document.documentElement.clientWidth || document.documentElement.clientHeight ) )
		  {
			//IE 6+ in 'standards compliant mode'
			myWidth = document.documentElement.clientWidth;
			myHeight = document.documentElement.clientHeight;

			document.getElementById("confirmlayer").style.top = (myHeight/2)-50;
			document.getElementById("confirmlayer").style.left = (myWidth/2)-140;


		  }
		  else if( document.body && ( document.body.clientWidth || document.body.clientHeight ) )
		  {
			//IE 4 compatible
			myWidth = document.body.clientWidth;
			myHeight = document.body.clientHeight;

			document.getElementById("confirmlayer").style.top = (myHeight/2)-50;
			document.getElementById("confirmlayer").style.left = (myWidth/2)-140;



		  }
	document.getElementById("confirmlayer").style.display = "block";
	document.getElementById("confirmlayer").style.position = "absolute";

	return false;
//included

}
}
}
//Added by pandiarajan for checking shopping cart location and division ends

function rskuSelected(language_code,base_link,lang_code,param2)
{
	var division = document.cart_quantity.division.value;
	var location = document.cart_quantity.location.value;
	var rskuItem = document.cart_quantity.rskuItem.options[document.cart_quantity.rskuItem.selectedIndex].value;
	checkInventory(rskuItem,division,location,language_code,base_link,lang_code,param2);
	return;

}
//Added by pandiarajan for checking shopping cart location and division starts
function itemsOverwrite(pd_url,session_id)
	{
//		var page = document.cart_quantity.page_name.value;
//		var osCsid = document.cart_quantity.osCsid.value;
		var shoppingLoc = document.cart_quantity.location.value;
		var shoppingDiv = document.cart_quantity.division.value;

		document.cart_quantity.action = pd_url+'&delete=1&shoppingLoc='+shoppingLoc+'&shoppingDiv='+shoppingDiv+session_id;
		document.cart_quantity.submit();
	}

function itemsdontOverwrite()
	{
		document.cart_quantity.addtocartclicked.value="no";
		document.getElementById("confirmlayer").style.display = "none";
		return false;
	}
//Added by pandiarajan for checking shopping cart location and division ends


function open_zoom(url){
	window.open(url,'','height=749,width=645,location=no,menubar=no,resizable=no,scrollbars=no,toolbar=no');
}


