window.onscroll=showBasketInsertNotice;

window.name="GCC_parent"

function MM_openBrWindow(theURL,winName,features) { //v2.0
  newWin = window.open(theURL,winName,features);
  if(javascript_version > 1.0){
  //delay a bit here because IE4 encounters errors
  //when trying to focus a recently opened window
  setTimeout("newWin.focus();",250);
	}
  return false;
}

function MM_preloadImages() { //v3.0
  var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
    var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
    if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}

function MM_swapImgRestore() { //v3.0
  var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}


function MM_findObj(n, d) { //v3.0
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document); return x;
}

function MM_swapImage() { //v3.0
  var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=4){
// alert("i is "+i+" a length is "+a.length);
  if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
  }
}

function togglediv(aDiv){

	output = 0;
	if (document.all) {

		if (document.all[aDiv].style.display == 'none'){
                         document.all[aDiv].style.display = '';
                         output = 1;
                } else {
                         document.all[aDiv].style.display = 'none';
                 	 output = 2;
                }

	} else if (document.getElementById) {
		if (document.getElementById(aDiv).style.display == 'none'){
                         document.getElementById(aDiv).style.display = '';
                         output = 1;
               }  else {
                        document.getElementById(aDiv).style.display = 'none';
                        output = 2;
               }
        }
        return output;
}

function togglehtml(id, onhtml, onstate, offhtml, offstate, state){
	// change the link text depending on state

	if (document.all){
		thelink = document.all[id];
	} else if (document.getElementById){
		thelink = document.getElementById(id);
	}


	// use if cos switch() crashes nn4

	if (state == onstate){
		thelink.innerHTML = onhtml;
	} else if (state == offstate){
		thelink.innerHTML = offhtml;
	}
}

function saveqsprefs(t){

	if (document.all){

		document.all["qsstate"].value = t;
		document.all["qsform"].submit();

	} else if (document.getElementById){

		document.getElementById('qsstate').value = t;
		document.getElementById('qsform').submit();
	}

}

function togglesearch(){

	t = togglediv("qsshow");

	togglehtml("qslink", "hide", 1, "show", 2, t);
	if (document.all && document.getElementById){
		// ie 5 or 6 reverts to IE4 style sheet, reassert
		document.getElementById('logo').style.position = 'static';
		document.getElementById('logo').style.position = 'relative';
         }

	if (t > 0){
		// state has been changed so set perferences
		saveqsprefs(t);
	}
	return false;
}

function showBasketInsertNotice(topOffset){
	var theDiv = document.getElementById('baskInsertNotice');
	//alert("theDiv has been called");
	if(theDiv && doScroller){
		theDiv.style.position = "absolute";
		if(typeof(document.media)=='string'){// only do this for ie
			//alert("In IE section");
			var s;
			// scrolling offset calculation via www.quirksmode.org
			if(self.pageYOffset){s = self.pageYOffset;}
			else if (document.documentElement && document.documentElement.scrollTop) {	s = document.documentElement.scrollTop; }
			else if (document.body) {	s = document.body.scrollTop; }
			theDiv.style.top= s;
			//if(!intv){
				theDiv.style.left = 50;
				//if(cbaTo == null){
					cbaTo = setTimeout('closeBasketAdd()',5000);
				//}
			//}
		}

		if(typeof(window.print)=='function'){// only do if not ie
			//alert("In not IE section");
			var x;
			// scrolling offset calculation via www.quirksmode.org
			if (self.pageXOffset){	x = self.pageXOffset;}
			else if (document.documentElement && document.documentElement.scrollTop){ x = document.documentElement.scrollLeft; }
			else if (document.body) {	x = document.body.scrollLeft;}
			//theDiv.style.left = (548	- x) + "px";
		}
//		theDiv.style.top= s;
		//var varStr = "";
		//for(var i in theDiv){
		//	varStr += i+": " + theDiv[i] + '\n';
		//}
		//document.getElementById('krisTextBox').innerText = varStr;

		//document.write("Doing it");
	}
	//doScroller = false;
}
var intv = null;
var cbaTo = null;
var lastLeft = 50;
var doScroller = true;

function closeBasketAdd(){
	clearTimeout(cbaTo);
	//intv = setInterval('moveBasketAdd()',5);
	//intv = setTimeout('moveBasketAdd()',10);
	var theDiv = document.getElementById('baskInsertNotice');
	theDiv.style.visibility = 'hidden';
	doScroller = false;
	//alert(parseInt(theDiv.style.left));
}

function moveBasketAdd(){
/*
	var theDiv = document.getElementById('baskInsertNotice');
	//clearInterval(intv);
	//clearTimeout(intv);
	if(theDiv){
		//theDiv.style.display = 'none';
		//theDiv.style.left = theDiv.style.left - 1;
		//alert(eval(theDiv.style.left));
		lastLeft = parseInt(theDiv.style.left) - 8;
		theDiv.style.left = lastLeft +"px";
		//theDiv.moveby(-2,0);
		//alert(theDiv.style.width);
		if(parseInt(theDiv.style.left) < (-500)){
			clearInterval(intv);
			intv = null;
			//document.onScroll = "";
			theDiv.style.display = 'none';
			//alert("Cleared at " + theDiv.style.left);
			doScroller = false;
			clearTimeout(cbaTo);
			cbaTo= null;
		}else{
			//intv = setTimeout('moveBasketAdd()',5);
			//theDiv.style.left = (theDiv.style.left + 20) +"px";
		}
	}
*/
}
