function HideAddToBasket(ProdIDS) {
   for (var i=0; i<ProdIDS.length; i++)
   {
      document.getElementById('AddToBasket_'+ProdIDS[i]).innerHTML = '';
   }
}

function FIND(item) {
  if (document.all) return(document.all[item]);
  if (document.getElementById) return(document.getElementById(item));
  return(false);
}

function lm_click(id) 
{
    if(FIND("a_"+id).className == 'plus')
    {
      FIND("a_"+id).className='minus';
      FIND("iu_"+id).style.display='block';
    } 
    else 
    {
      FIND("a_"+id).className='plus';
      FIND("iu_"+id).style.display='none';
    }
}

/* Get browser viewport width and height */
var viewportwidth;
var viewportheight; 
if (typeof window.innerWidth != 'undefined') {
	viewportwidth = window.innerWidth,
	viewportheight = window.innerHeight
} else if (typeof document.documentElement != 'undefined' && typeof document.documentElement.clientWidth != 'undefined' && document.documentElement.clientWidth != 0) {
	viewportwidth = document.documentElement.clientWidth,
	viewportheight = document.documentElement.clientHeight
} 
else {
	viewportwidth = document.getElementsByTagName('body')[0].clientWidth,
	viewportheight = document.getElementsByTagName('body')[0].clientHeight
}
/* end Get browser viewport width and height */

var st1;
var st2;
var oMyDiv;
var boxMyDiv;

function writeContentDoc(Doc, TargetId) {
	if(!oMyDiv) oMyDiv=document.createElement("div");
	oMyDiv.innerHTML=Doc;
	var oInsertTarget=document.getElementById(TargetId);
	var InsertHTML = oMyDiv.innerHTML;
	var string = InsertHTML.replace(/<html (.*?)>/g,'');
  var string1 = string.replace(/<\/html>/g,'');
  var string2 = string1.replace(/<!DOCTYPE (.*?)>/g,''); 
  oInsertTarget.innerHTML = string2;
}

function writeContentBox(Doc, TargetId) {
	if(!boxMyDiv) 
		boxMyDiv=document.createElement("div");
	boxMyDiv.innerHTML=Doc;
	var oInsertTarget=document.getElementById(TargetId);
	//oInsertTarget.innerHTML=boxMyDiv.innerHTML;
	var InsertHTML = boxMyDiv.innerHTML;
	var string = InsertHTML.replace(/<html (.*?)>/g,'');
  var string1 = string.replace(/<\/html>/g,'');
  var string2 = string1.replace(/<!DOCTYPE (.*?)>/g,''); 
  oInsertTarget.innerHTML = string2;
}

function writeContent(url, DocTargetId, writeFunc) {
	makeHttpRequest("GET",WebServerScriptUrlSSL+url+'&rand='+Math.floor(Math.random()*1000000),'', false, writeFunc, DocTargetId);
}

function getop(){
  if (navigator.appName == "Netscape") {
    return window.pageYOffset;
  }
  else {
    return (document.body.scrollTop)?document.body.scrollTop:document.documentElement.scrollTop;
  }
}

function centerDiv(){
  var suffix="";
  if(FIND('divbasketpopup').style.left.indexOf('px') >=0){
    suffix="px";
  }
  FIND('divbasketpopup').style.left=Math.floor((viewportwidth-285)/2)+suffix;
  FIND('divbasketpopup').style.top=Math.floor((viewportheight-150)/2)+suffix;
}

function appendProductURL(formular){
	var urlstr = "";
	var productParams = new Array('ChangeObjectID','ProductID');
	for(var i=0;i<productParams.length;i++){
	urlstr += "&"+productParams[i]+"="+eval("formular."+productParams[i]+".value");  
	}

	var quantity = parseInt(eval("formular.Quantity.value"));
	if (!quantity) 
		quantity = 1;
	urlstr += "&Quantity="+quantity;  

	return urlstr;
}

function divpopup(url,formular){
	url+=appendProductURL(formular);
	writeContent(url,'divbasketpopup','writeContentDoc');  
	if(st1)	{
		clearTimeout(st1);
	}
	centerDiv();
	FIND('divbasketpopup').style.visibility='visible';

	st1=setTimeout("FIND('divbasketpopup').style.visibility='hidden'",7000);
}

function closedivpopup(){
  FIND('divbasketpopup').style.visibility='hidden';   
}



