// JavaScript Document
var xmlhttp;

function GetXmlHttpObject()
{
var xmlHttp=null;
try
  {
  xmlHttp=new XMLHttpRequest();
  }
catch (e)
  {
  try
    {
    xmlHttp=new ActiveXObject("Msxml2.XMLHTTP");
    }
  catch (e)
    {
    xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");
    }
  }
return xmlHttp;
}

function basketFunction(){
	var thisfun=document.forms[0].basketFunctions.value;
	if(thisfun=="NONE"){
		return;
	}
	else{
		if(thisfun=="qnt"){
			updateBasket();
			return;
		}
				if(thisfun=="rem"){
			removeBasket();
			return;
		}
						if(thisfun=="del"){
			emptyBasket();
			return;
		}		
	}
}

   //delete from basket
   
    function removeBasket() { 
 if (confirm('Are you sure you want to REMOVE the item(s) ticked?\n\nThis action cannot be undone!')) {
	for (i=0; i<document.forms[0].elements.length; i++) { 
		el = document.forms[0].elements[i];
		if (el.type=="checkbox" && el.name.indexOf("checkBox")!=-1){
			if (el.checked) {
			var id = el.name.replace(/checkBox/, "");
			deleteme(id);
}
		} 
	}
	returnBasket();
	}
}

function deleteme(id){
xmlHttp=GetXmlHttpObject();
if (xmlHttp==null) {
  alert ("Your browser does not support AJAX!");
  return;
  } 
var url="/resource/working/commerce/deleteItem.asp";
url=url+"?id="+id;
xmlHttp.open("GET",url,true);
xmlHttp.send(null);
}

function deletemesingle(id){
	 if (confirm('Are you sure you want to DELETE this item?\n\nThis action cannot be undone!')) {
var url="/resource/working/commerce/deleteItem.asp";
url=url+"?id="+id;
document.location.href=url;
	 }
	 return;
}

function deleteme2(id){
xmlHttp=GetXmlHttpObject();
if (xmlHttp==null) {
  alert ("Your browser does not support AJAX!");
  return;
  } 
var url="/resource/working/commerce/deleteBasket.asp"
url=url+"?id="+id;
xmlHttp.open("GET",url,true);
xmlHttp.send(null);
}

    function emptyBasket() { 
 if (confirm('Are you sure you want to EMPTY the entire basket?\n\nThis action cannot be undone!')) {
document.location.href="/resource/working/commerce/deleteBasket.asp"
	}
}

function updateMe(id,qnt){
xmlHttp=GetXmlHttpObject();
if (xmlHttp==null) {
  alert ("Your browser does not support AJAX!");
  return;
  } 
var url="/resource/working/commerce/updateItem.asp"
url=url+"?id="+id;
url=url+"&qnt="+qnt;
//document.location.href=url
xmlHttp.open("GET",url,true);
xmlHttp.send(null);
}

function updatemesingle(id){
x="qnt"+id
qnt=document.getElementById(x).value;
var url="/resource/working/commerce/updateItem.asp"
url=url+"?id="+id;
url=url+"&qnt="+qnt;
document.location.href=url;
}

    function updateBasket() { 
// if (confirm('Are you sure you want to UPDATE the selection(s) ticked?')) {
 var qnt;
 var x;
 var id;
	for (i=0; i<document.forms[0].elements.length; i++) { 
		el = document.forms[0].elements[i];
		if (el.type=="checkbox" && el.name.indexOf("checkBox")!=-1){
			if (el.checked) {
			id = el.name.replace(/checkBox/, "");
			x = "qnt" + id;
			qnt = document.getElementById(x).value;
			updateMe(id,qnt);
}
		} 
	}
	returnBasket();
//	}
}

function returnBasket(){
	//mydiv=getQueryVariable('div');
	//mycat=getQueryVariable('cat');
window.location.href="/commerce-basket.asp";
	}
	
	function returnBasket2(){
var kill_time = new Date("January 1, 1970");
var kill_string = "buttonjewellery=;expires=" + kill_time.toGMTString();
document.cookie = kill_string;
	mydiv=getQueryVariable('div');
	mycat=getQueryVariable('cat');
//window.location.href="/shop-online.asp?div=" + mydiv + "&cat=" + mycat;
window.location.href="/";
	}
	
	function getQueryVariable(variable) { 
	var query = window.location.search.substring(1); 
	var vars = query.split("&"); 
	for (var i=0;i<vars.length;i++) {   
	var pair = vars[i].split("=");   
	if (pair[0] == variable) {     
	return pair[1];   
	} 
	} 
	alert('Query Variable ' + variable + ' not found');
	}
	
	function selDes(obj){
		var x = "checkBox"+obj;
		if(document.getElementById(x).checked==true){
			document.getElementById(x).checked=false;
		}
		else{
			document.getElementById(x).checked=true
		}
	}
	
	var bCode;

function addEditProfile() {

//error checking........................................................................
var ititle = document.forms[0].ititle.value;
var fname = document.forms[0].fname.value;
var sname = document.forms[0].sname.value;
var ad1 = document.forms[0].ad1.value;
var ad2 = document.forms[0].ad2.value;
var ad3 = document.forms[0].ad3.value;
var ad4 = document.forms[0].ad4.value;
var town = document.forms[0].town.value;
var county = document.forms[0].county.value;
var postcode = document.forms[0].postcode.value;
var country = document.forms[0].country.value;
var telephone = document.forms[0].telephone.value;
var emailaddress = document.forms[0].emailaddressagain.value;

var ititle2 = document.forms[0].ititle2.value;
var fname2 = document.forms[0].fname2.value;
var sname2 = document.forms[0].sname2.value;
var ad12 = document.forms[0].ad12.value;
var ad22 = document.forms[0].ad22.value;
var ad32 = document.forms[0].ad32.value;
var ad42 = document.forms[0].ad42.value;
var town2 = document.forms[0].town2.value;
var county2 = document.forms[0].county2.value;
var postcode2 = document.forms[0].postcode2.value;
var country2 = document.forms[0].country2.value;
var telephone2 = document.forms[0].telephone2.value;
//var emailaddress2 = document.forms[0].emailaddress2.value;

// reset fields before alert.......................................................
document.getElementById("a1").innerHTML = "";
document.getElementById("a2").innerHTML = "";
document.getElementById("a3").innerHTML = "";
document.getElementById("a4").innerHTML = "";
document.getElementById("a5").innerHTML = "";
document.getElementById("a6").innerHTML = "";
document.getElementById("a7").innerHTML = "";
document.getElementById("a8").innerHTML = "";
document.getElementById("a9").innerHTML = "";
document.getElementById("a10").innerHTML = "";
document.getElementById("a21").innerHTML = "";
document.getElementById("a22").innerHTML = "";
document.getElementById("a23").innerHTML = "";
document.getElementById("a24").innerHTML = "";
document.getElementById("a25").innerHTML = "";
document.getElementById("a26").innerHTML = "";
document.getElementById("a27").innerHTML = "";
document.getElementById("a28").innerHTML = "";
document.getElementById("a29").innerHTML = "";
//document.getElementById("a12").innerHTML = "";
//document.getElementById("a13").innerHTML = "";
//..........................................................................................

var thisAlert="<a name=alert></a>&nbsp;Required&nbsp;";

if(ititle2==""){
document.getElementById("a1").innerHTML = thisAlert;
document.location.href="#alert";
return;
}
else if (fname2==""){
document.getElementById("a2").innerHTML = thisAlert;
document.location.href="#alert";
return;
}
else if (sname2==""){
document.getElementById("a3").innerHTML = thisAlert;
document.location.href="#alert";
return;
}
else if (ad12==""){
document.getElementById("a4").innerHTML = thisAlert;
document.location.href="#alert";
return;
}
else if (town2==""){
document.getElementById("a5").innerHTML = thisAlert;
document.location.href="#alert";
return;
}
else if (county2==""){
document.getElementById("a6").innerHTML = thisAlert;
document.location.href="#alert";
return;
}
else if (postcode2==""){
document.getElementById("a7").innerHTML = thisAlert;
document.location.href="#alert";
return;
}
else if (country2==""){
document.getElementById("a8").innerHTML = thisAlert;
document.location.href="#alert";
return;
}
else if (telephone2==""){
document.getElementById("a9").innerHTML = thisAlert;
document.location.href="#alert";
return;
}
else if (emailaddress==""){
document.getElementById("a10").innerHTML = thisAlert;
document.location.href="#alert";
return;
}

var issame="no"
if (document.forms[0].issame.checked){
	issame="yes"		
}
else if(ititle==""){
document.getElementById("a21").innerHTML = thisAlert;
document.location.href="#alert";
return;
}
else if (fname==""){
document.getElementById("a22").innerHTML = thisAlert;
document.location.href="#alert";
return;
}
else if (sname==""){
document.getElementById("a23").innerHTML = thisAlert;
document.location.href="#alert";
return;
}
else if (ad1==""){
document.getElementById("a24").innerHTML = thisAlert;
document.location.href="#alert";
return;
}
else if (town==""){
document.getElementById("a25").innerHTML = thisAlert;
document.location.href="#alert";
return;
}
else if (county==""){
document.getElementById("a26").innerHTML = thisAlert;
document.location.href="#alert";
return;
}
else if (postcode==""){
document.getElementById("a27").innerHTML = thisAlert;
document.location.href="#alert";
return;
}
else if (country==""){
document.getElementById("a28").innerHTML = thisAlert;
document.location.href="#alert";
return;
}
else if (telephone==""){
document.getElementById("a29").innerHTML = thisAlert;
document.location.href="#alert";
return;
}

var ipassword="";
var securityQuestion="";
var securityAnswer="";
var ipassword2="";
	
var regme="no"
if(document.forms[0].regme){
if (document.forms[0].regme.checked){
regme="yes";
}
}


	
var canmail="no"
if(document.forms[0].canmail){
if (document.forms[0].canmail.checked){
canmail="yes";
	}	
	}
	
	

var thisLot;
thisLot = "ititle=" + encodeURIComponent(document.forms[0].ititle.value);
thisLot = thisLot + "&fname=" + encodeURIComponent(document.forms[0].fname.value);
thisLot = thisLot + "&sname=" + encodeURIComponent(document.forms[0].sname.value);
thisLot = thisLot + "&ad1=" + encodeURIComponent(document.forms[0].ad1.value);
thisLot = thisLot + "&ad2=" + encodeURIComponent(document.forms[0].ad2.value);
thisLot = thisLot + "&ad3=" + encodeURIComponent(document.forms[0].ad3.value);
thisLot = thisLot + "&ad4=" + encodeURIComponent(document.forms[0].ad4.value);
thisLot = thisLot + "&town=" + encodeURIComponent(document.forms[0].town.value);
thisLot = thisLot + "&postcode=" + encodeURIComponent(document.forms[0].postcode.value);
thisLot = thisLot + "&county=" + encodeURIComponent(document.forms[0].county.value);
thisLot = thisLot + "&country=" + encodeURIComponent(document.forms[0].country.value);
thisLot = thisLot + "&emailaddress1=" + encodeURIComponent(document.forms[0].emailaddressagain.value);
thisLot = thisLot + "&telephone=" + encodeURIComponent(document.forms[0].telephone.value);

thisLot = thisLot + "&ititle2=" + encodeURIComponent(document.forms[0].ititle2.value);
thisLot = thisLot + "&fname2=" + encodeURIComponent(document.forms[0].fname2.value);
thisLot = thisLot + "&sname2=" + encodeURIComponent(document.forms[0].sname2.value);
thisLot = thisLot + "&ad12=" + encodeURIComponent(document.forms[0].ad12.value);
thisLot = thisLot + "&ad22=" + encodeURIComponent(document.forms[0].ad22.value);
thisLot = thisLot + "&ad32=" + encodeURIComponent(document.forms[0].ad32.value);
thisLot = thisLot + "&ad42=" + encodeURIComponent(document.forms[0].ad42.value);
thisLot = thisLot + "&town2=" + encodeURIComponent(document.forms[0].town2.value);
thisLot = thisLot + "&postcode2=" + encodeURIComponent(document.forms[0].postcode2.value);
thisLot = thisLot + "&county2=" + encodeURIComponent(document.forms[0].county2.value);
thisLot = thisLot + "&country2=" + encodeURIComponent(document.forms[0].country2.value);
//thisLot = thisLot + "&emailaddress2=" + encodeURIComponent(document.forms[0].emailaddress2.value);
thisLot = thisLot + "&telephone2=" + encodeURIComponent(document.forms[0].telephone2.value);
thisLot = thisLot + "&oldemail=" + encodeURIComponent(document.forms[0].oldemail.value);
thisLot = thisLot + "&regme=" + regme;
thisLot = thisLot + "&issame=" + issame;
thisLot = thisLot + "&orderno=" + encodeURIComponent(document.forms[0].orderno.value);


//bCode = encodeURIComponent(document.forms[0].basketCode.value);
var url="/resource/working/profileAddUpdate.asp"

//document.location.href=url+"?"+thisLot

xmlHttp=GetXmlHttpObject();
if (xmlHttp==null) {
  alert ("Your browser does not support AJAX!");
  return;
  } 

xmlHttp.onreadystatechange = sendtocheckoutwait;
xmlHttp.open("POST",url,true);
xmlHttp.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
xmlHttp.setRequestHeader("Content-length", thisLot.length);
xmlHttp.setRequestHeader("Connection", "close");
xmlHttp.send(thisLot);


}


   function sendtopaypalwait() {
if (xmlHttp.readyState == 4) {
         if (xmlHttp.status == 200) {        
sendToPaypal();
         } else {
		 //alert(xmlHttp.responseText);
            alert('There was a problem with the request.');
         }
      }     
   }
   
   
      function sendtocheckoutwait() {
if (xmlHttp.readyState == 4) {
         if (xmlHttp.status == 200) {        
document.location.href="/commerce-checkout.asp";
         } else {
		 alert(xmlHttp.responseText);
            alert('There was a problem with the request.');
         }
      }     
   }
   
function makeTransaction(){
	
	if(document.forms[0].checkread.checked==false){
		alert("Please tick the box to acknowledge that you have read, understand, and agree with our terms and conditions")
		return;
	}
	

var thisLot;
thisLot = "basketCode=" + bCode; //encodeURIComponent(document.forms[0].basketCode.value);
//thisLot = thisLot + "&fname=" + encodeURIComponent(document.forms[0].fname.value);
//thisLot = thisLot + "&sname=" + encodeURIComponent(document.forms[0].sname.value);
//thisLot = thisLot + "&ad1=" + encodeURIComponent(document.forms[0].ad1.value);
//thisLot = thisLot + "&ad2=" + encodeURIComponent(document.forms[0].ad2.value);
//thisLot = thisLot + "&ad3=" + encodeURIComponent(document.forms[0].ad3.value);
//thisLot = thisLot + "&ad4=" + encodeURIComponent(document.forms[0].ad4.value);
//thisLot = thisLot + "&town=" + encodeURIComponent(document.forms[0].town.value);
//thisLot = thisLot + "&postcode=" + encodeURIComponent(document.forms[0].postcode.value);
//thisLot = thisLot + "&county=" + encodeURIComponent(document.forms[0].county.value);
//thisLot = thisLot + "&country=" + encodeURIComponent(document.forms[0].country.value);
//thisLot = thisLot + "&emailaddress=" + encodeURIComponent(document.forms[0].emailaddress.value);
//thisLot = thisLot + "&telephone=" + encodeURIComponent(document.forms[0].telephone.value);
//thisLot = thisLot + "&basketCode=" + encodeURIComponent(document.forms[0].basketCode.value);
//thisLot = thisLot + "&totalCost=" + encodeURIComponent(document.forms[0].totalCost.value);
// PAYPAL FIELDS HERE

var url="/resource/working/sendToStreamline2.asp";
document.location.href=url+"?"+thisLot;

}


function minusme(obj){
	var x=obj;
	var ca=document.getElementById(x).value;
if(ca>1){
	ca--;
document.getElementById(x).value=ca;
}
}

function plusme(obj){
	var x=obj;
	var ca=document.getElementById(x).value;
if(ca>0){
	ca++;
document.getElementById(x).value=ca;
}
}

var gid;

function mclBasket(obj,obj2,obj3,img,orig){
	
	

	var x=obj;
	var y=orig; //document.getElementById(x).value;
	
	var z="pQnt"+orig;

	startmove(orig,img);
	var div=obj2;
	var cat=obj3;
	var id=y;
	
	var qnt=document.getElementById(z).value;
//	gid=id;
	
	var thisLot="div=" +encodeURIComponent(div);
	thisLot=thisLot+"&cat=" +encodeURIComponent(cat);
	thisLot=thisLot+"&id=" +encodeURIComponent(id);
	thisLot=thisLot+"&qnt=" +encodeURIComponent(qnt);
	
	//alert(thisLot);
	
	var url="/resource/working/commerce/getBasket.asp"

//document.location.href=url+"?"+thisLot

xmlHttp=GetXmlHttpObject();
if (xmlHttp==null) {
  alert ("Your browser does not support AJAX!");
  return;
  } 

xmlHttp.onreadystatechange = updateMiniBasket;
xmlHttp.open("POST",url,true);
xmlHttp.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
xmlHttp.setRequestHeader("Content-length", thisLot.length);
xmlHttp.setRequestHeader("Connection", "close");
xmlHttp.send(thisLot);
	
}

function mclBasketOrig(obj,obj2,obj3,img){
	
	startmove(obj,img);
	var div=obj2;
	var cat=obj3;
	var id=obj;
	var qnt=document.getElementById('pQnt'+id).value;
//	gid=id;
	
	var thisLot="div=" +encodeURIComponent(div);
	thisLot=thisLot+"&cat=" +encodeURIComponent(cat);
	thisLot=thisLot+"&id=" +encodeURIComponent(id);
	thisLot=thisLot+"&qnt=" +encodeURIComponent(qnt);
	
	//alert(thisLot);
	
	var url="/resource/working/commerce/getBasket.asp"

//document.location.href=url+"?"+thisLot

xmlHttp=GetXmlHttpObject();
if (xmlHttp==null) {
  alert ("Your browser does not support AJAX!");
  return;
  } 

xmlHttp.onreadystatechange = updateMiniBasket;
xmlHttp.open("POST",url,true);
xmlHttp.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
xmlHttp.setRequestHeader("Content-length", thisLot.length);
xmlHttp.setRequestHeader("Connection", "close");
xmlHttp.send(thisLot);
	
}

function mclBasketWish(obj){
	
	
	var id=obj;
	var qnt=1; //document.getElementById('pqnt'+id).value;
//	gid=id;
	
	//var thisLot="div=" +encodeURIComponent(div);
	///thisLot=thisLot+"&cat=" +encodeURIComponent(cat);
	var thisLot="id=" +encodeURIComponent(id);
	thisLot=thisLot+"&qnt=" +encodeURIComponent(qnt);
	
	//alert(thisLot);
	
	var url="/resource/working/commerce/getBasketWish.asp"

//document.location.href=url+"?"+thisLot

xmlHttp=GetXmlHttpObject();
if (xmlHttp==null) {
  alert ("Your browser does not support AJAX!");
  return;
  } 

xmlHttp.onreadystatechange = updateMiniBasket;
xmlHttp.open("POST",url,true);
xmlHttp.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
xmlHttp.setRequestHeader("Content-length", thisLot.length);
xmlHttp.setRequestHeader("Connection", "close");
xmlHttp.send(thisLot);
	
}

var shout=0;

   function updateMiniBasket() {
if (xmlHttp.readyState == 4) {
         if (xmlHttp.status == 200) {        
//document.getElementById("basketQuickHere").innerHTML=xmlHttp.responseText;
setTimeout("window.location.reload()",500);
         } else {
		 //alert(xmlHttp.responseText);
            alert('There was a problem with the request.');
         }
      }     
   }
   
   
function startmove(obj,img){


var sX = Position.get(document.getElementById('tImage'));
var sY = Position.get(document.getElementById('tImage')); 

sX=sX.left;
sY=sY.top

var obj = document.getElementById('mover');
obj.style.left=sX + "px";
obj.style.top=sY + "px";
obj.innerHTML="<img src=" + img + " width=50>"
obj.style.display="";
gomove();
}

function gomove(){
var obj = document.getElementById('mover');
sX=0
sY=0
var sX = Position.get(obj);
var sY = Position.get (obj); 
sX=sX.left;
sY=sY.top

var fX =Position.get(document.getElementById('movetohere'));
var fY = Position.get(document.getElementById('movetohere')); 
fX=fX.left;
fY=fY.top


if(sX<fX){
pos=parseInt(sX-(sX-fX)/10);
obj.style.left=pos + "px";
pos2=parseInt(sY-(sY-fY)/10);
obj.style.top=pos2 + "px";
setTimeout("gomove()",10);
}

if(sX> parseInt(fX-50)){
obj.style.display="none";
obj.style.left="0px"
obj.style.top="0px"
}

}
  

var Position = (function() {
  // Resolve a string identifier to an object
  // ========================================
  function resolveObject(s) {
    if (document.getElementById && document.getElementById(s)!=null) {
      return document.getElementById(s);
    }
    else if (document.all && document.all[s]!=null) {
      return document.all[s];
    }
    else if (document.anchors && document.anchors.length && document.anchors.length>0 && document.anchors[0].x) {
      for (var i=0; i<document.anchors.length; i++) {
        if (document.anchors[i].name==s) { 
          return document.anchors[i]
        }
      }
    }
  }
  
  var pos = {};
  pos.$VERSION = 1.0;
  
  // Set the position of an object
  // =============================
  pos.set = function(o,left,top) {
    if (typeof(o)=="string") {
      o = resolveObject(o);
    }
    if (o==null || !o.style) {
      return false;
    }
    
    // If the second parameter is an object, it is assumed to be the result of getPosition()
    if (typeof(left)=="object") {
      var pos = left;
      left = pos.left;
      top = pos.top;
    }
    
    o.style.left = left + "px";
    o.style.top = top + "px";
    return true;
  };
  
  // Retrieve the position and size of an object
  // ===========================================
  pos.get = function(o) {
    var fixBrowserQuirks = true;
      // If a string is passed in instead of an object ref, resolve it
    if (typeof(o)=="string") {
      o = resolveObject(o);
    }
    
    if (o==null) {
      return null;
    }
    
    var left = 0;
    var top = 0;
    var width = 0;
    var height = 0;
    var parentNode = null;
    var offsetParent = null;
  
    
    offsetParent = o.offsetParent;
    var originalObject = o;
    var el = o; // "el" will be nodes as we walk up, "o" will be saved for offsetParent references
    while (el.parentNode!=null) {
      el = el.parentNode;
      if (el.offsetParent==null) {
      }
      else {
        var considerScroll = true;
        /*
        In Opera, if parentNode of the first object is scrollable, then offsetLeft/offsetTop already 
        take its scroll position into account. If elements further up the chain are scrollable, their 
        scroll offsets still need to be added in. And for some reason, TR nodes have a scrolltop value
        which must be ignored.
        */
        if (fixBrowserQuirks && window.opera) {
          if (el==originalObject.parentNode || el.nodeName=="TR") {
            considerScroll = false;
          }
        }
        if (considerScroll) {
          if (el.scrollTop && el.scrollTop>0) {
            top -= el.scrollTop;
          }
          if (el.scrollLeft && el.scrollLeft>0) {
            left -= el.scrollLeft;
          }
        }
      }
      // If this node is also the offsetParent, add on the offsets and reset to the new offsetParent
      if (el == offsetParent) {
        left += o.offsetLeft;
        if (el.clientLeft && el.nodeName!="TABLE") { 
          left += el.clientLeft;
        }
        top += o.offsetTop;
        if (el.clientTop && el.nodeName!="TABLE") {
          top += el.clientTop;
        }
        o = el;
        if (o.offsetParent==null) {
          if (o.offsetLeft) {
            left += o.offsetLeft;
          }
          if (o.offsetTop) {
            top += o.offsetTop;
          }
        }
        offsetParent = o.offsetParent;
      }
    }
    
  
    if (originalObject.offsetWidth) {
      width = originalObject.offsetWidth;
    }
    if (originalObject.offsetHeight) {
      height = originalObject.offsetHeight;
    }
    
    return {'left':left, 'top':top, 'width':width, 'height':height
        };
  };
  
  // Retrieve the position of an object's center point
  // =================================================
  pos.getCenter = function(o) {
    var c = this.get(o);
    if (c==null) { return null; }
    c.left = c.left + (c.width/2);
    c.top = c.top + (c.height/2);
    return c;
  };
  
  return pos;
})();

function mclBasketFull(obj){
	alert("Sorry, the item you chose to purchase\n\n" + obj + "\n\nis currently out of stock");
}

function clickall(){
for (i=0; i<document.forms[0].elements.length; i++) { 
		el = document.forms[0].elements[i];
		if (el.type=="checkbox" && el.name.indexOf("checkBox")!=-1){
			if (el.checked) {
			el.checked=false;}
			else{
			el.checked=true;
}
		} 
	}
	
}

function getPromo(){
	document.location.href="/commerce-checkout.asp?promo=" + document.forms[0].promocode.value;
}

function mclBasketMulti(obj2,obj3,img){
	var x=obj2;
	var y=obj3;
	var z = img;
 if (confirm('Are you sure you want to ADD the ticked item(s)?')) {
 var id;
	for (i=0; i<document.forms[0].elements.length; i++) { 
		el = document.forms[0].elements[i];
		if (el.type=="checkbox" && el.name.indexOf("checkBox")!=-1){
			if (el.checked) {
			id = el.name.replace(/checkBox/, "");
			//x = "qnt" + id;
			//qnt = document.getElementById(x).value;
			mclBasketOrig(id,x,y,z);

}
		} 
	}
	//returnBasket();
	}
}

function benefits(){
	alert("* Add items to your wishlist\n* Save time on your next purchase\n* View your account profile & purchase history \n* Re-order previously purchased goods with one click\n* Receive exclusive offers\n* Obtain up-to-date news about new products and trends ");
}

var quickid;	

function wishlist(obj,img){
	
startmove2(obj,img);
var thisLot="id=" +encodeURIComponent(obj);
quickid=obj;
var url="/resource/working/commerce/getWishlist.asp"

xmlHttp=GetXmlHttpObject();
if (xmlHttp==null) {
  alert ("Your browser does not support AJAX!");
  return;
  } 

//xmlHttp.onreadystatechange = showwish;
xmlHttp.open("POST",url,true);
xmlHttp.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
xmlHttp.setRequestHeader("Content-length", thisLot.length);
xmlHttp.setRequestHeader("Connection", "close");
xmlHttp.send(thisLot);
	
}

   function showwish() {
if (xmlHttp.readyState == 4) {
         if (xmlHttp.status == 200) {        
document.getElementById("basketQuickHere").innerHTML=xmlHttp.responseText;
         } else {
		 //alert(xmlHttp.responseText);
            alert('There was a problem with the request.');
         }
      }     
   }
   
   function startmove2(obj,img){

var sX = Position.get(document.getElementById('movstart'+obj));
var sY = Position.get(document.getElementById('movstart'+obj)); 
sX=sX.left;
sY=sY.top
var obj = document.getElementById('mover');
obj.style.left=sX + "px";
obj.style.top=sY + "px";
obj.innerHTML="<img src=" + img + " width=50>"
obj.style.display="";
gomove2();
}

function gomove2(){
var obj = document.getElementById('mover');
sX=0
sY=0
var sX = Position.get(obj);
var sY = Position.get (obj); 
sX=sX.left;
sY=sY.top
var fX =Position.get(document.getElementById('movetohead'));
var fY = Position.get(document.getElementById('movetohead')); 
fX=fX.left;
fY=fY.top


if(sX<fX){
pos=parseInt(sX-(sX-fX)/20);
obj.style.left=pos + "px";
pos2=parseInt(sY-(sY-fY)/20);
obj.style.top=pos2 + "px";
setTimeout("gomove()",10);
}
if(sX> parseInt(fX-50)){
obj.style.display="none";
obj.style.left="0px"
obj.style.top="0px"
}
}

var tab;

function removewish(obj){
	
	tab=2;
	
var thisLot="id=" +encodeURIComponent(obj);
quickid=obj;
var url="/resource/working/commerce/removewish.asp"
	
	xmlHttp=GetXmlHttpObject();
if (xmlHttp==null) {
  alert ("Your browser does not support AJAX!");
  return;
  } 

xmlHttp.onreadystatechange = updatesecure;
xmlHttp.open("POST",url,true);
xmlHttp.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
xmlHttp.setRequestHeader("Content-length", thisLot.length);
xmlHttp.setRequestHeader("Connection", "close");
xmlHttp.send(thisLot);

   function updatesecure() {
if (xmlHttp.readyState == 4) {
         if (xmlHttp.status == 200) {        
		 document.location.href="/my-secure-area.asp?id=" + tab;
         } else {
		 //alert(xmlHttp.responseText);
            alert('There was a problem with the request.');
         }
      }     
   }
	
}

function nowishlist(){
popit('wishlist');
}

function fireNext(){
	
	if (document.getElementById('addnext').value=="Yes"){
		document.location.href="/commerce-checkout.asp?next=1"
	}
	else
	{
		document.location.href="/commerce-checkout.asp?next=0"
	}
}

function fireNext2(obj){
	
	if (obj==1){
		document.location.href="/commerce-checkout.asp?next=1"
	}
	else
	{
		document.location.href="/commerce-checkout.asp?next=0"
	}
}
