function trackTransaction(){
	if(document.getElementById("thankYouPage"))
		{__utmSetTrans();}
}

function openSizeWindow(popurl){
var winpops=window.open('http://www.wellie-web.co.uk/ires/53/ww/wwsizeguides/'+popurl,'','width=650,height=200,toolbar=no,resizable=yes')
}


//------------------------------------START SPECIAL OFFERS--------------------------
//Get a WOSID if exists
function getWOSID(aURL){
	re=/wosid=([^\&]*)/;

	if(re.exec(aURL)){
		
		return RegExp.$1;
		}
	return;
}
//Get the appId if it exists
function getAppID(aURL){
	re=/\/(\d+)?\/?wa/;
	
	if(re.exec(aURL)){
		
		return RegExp.$1;
		}
	return;
}

//The getElements() method returns an array of elements with the class applied 
//to them. If you want to scan the whole document, use document as the oElm 
//paramter and * as the strTagName parameter.
function check(oElm, strClassName){
	    strClassName = strClassName.replace(/\-/g, "\\-");
	    var oRegExp = new RegExp("(^|\\s)" + strClassName + "(\\s|$)");
		return oRegExp.test(oElm.className);
		}

//The getElements() method returns an array of elements with the css class 
//applied to them. If you want to scan the whole document, use document as the 
//oElm paramter and * as the strTagName parameter.
function getElements(oElm, strTagName, strClassName){
	    var arrElements = (strTagName == "*" && oElm.all)? oElm.all : oElm.getElementsByTagName(strTagName);
	    var arrReturnElements = [];
	    for(var i=0; i<arrElements.length; i++){
	        var temp = arrElements[i];      
			if(check(temp, strClassName)){
				arrReturnElements.push(temp);
			}
	    }
	    return (arrReturnElements)
	}
	
//Does the array passed contain the regex, rtn true or false.
function stringArrayContains(array, regex){
	if(array.length==0)return false;
	
	for (var i = 0; i < array.length; i++) 
	{
		if(regex.test(array[i]))return true;
	}
	return false;
}

//get the Text contained by the cart links ie the product names.
function getCartProductText(){
//get the cart product links
var arrCartProductLinkElements=getElements(document, "a", "cartProductLink")
//get their respective text
var arrCartElementText = [];
for(var i=0; i<arrCartProductLinkElements.length; i++)
	{
		arrCartElementText.push(arrCartProductLinkElements[i].childNodes.item(0).data);
	}
	return arrCartElementText;
}

//write the special offer
function specialOffer0(){
//Product id
var prodId="30670";
//Cat id
var catId="1251";
//Offer invalidator text
var invalid1=/Wellington Boot Bag.?/i;
//get the cartContents
var cartLinkTextArray=getCartProductText();
//No product  means no offer!
if(cartLinkTextArray.length==0) return;
//If it contains the invalid text then stop here.
if(stringArrayContains(cartLinkTextArray,invalid1)) return;
// we can present the offer......
//get the wosid and appid we may need them.
var woSID=getWOSID(location.href);
var appID=getAppID(location.href);


if(woSID)
	{
		//we have a WSID so we don't have cookies
		var addToCartLink="/" + appID +"/wa/4/40/"+catId+"/"+prodId+"/mpp?wosid="+woSID;
	}
	else
	{
		var addToCartLink="/wa/4/40/"+catId+"/"+prodId+".html";

	}
document.write("<div style='width:280px;border:1px solid #3AA267;margin:10px 4px 10px 0px;padding:2px;float:left;'>");
document.write("<img style='float:left;height:118px;margin-right:2px' alt='Wellington Boot Bag' src='/ires/53/WW/wwProductImages/ww-boot-bag-lrg.jpg'>");
document.write("<p style='font-weight:bold;font-size:12pt;color:#C6420E;'>Half Price.......<\/p>");
document.write("<p style='color:#006699'>Keep your house and car clean.<br><br><b>Add<\/b> this wellington boot bag for just <b>&pound;7.20<\/b>");
document.write("<a class='productListAddToBasketLink' href='"+addToCartLink+"'>Add To Cart<\/a><\/p><\/div>");
return;

}

//write the special offer
function specialOffer1(){
//Product id
var prodId="32076";
//Cat id
var catId="1251";
//Offer invalidator text
var invalid1=/Toasti-Toes.?|Foot-Warmers.?/i;
//get the cartContents
var cartLinkTextArray=getCartProductText();
//No product  means no offer!
if(cartLinkTextArray.length==0) return;
//If it contains the invalid text then stop here.
if(stringArrayContains(cartLinkTextArray,invalid1)) return;
// we can present the offer......
//get the wosid and appid we may need them.
var woSID=getWOSID(location.href);
var appID=getAppID(location.href);


if(woSID)
	{
		//we have a WSID so we don't have cookies
		var addToCartLink="/" + appID +"/wa/4/40/"+catId+"/"+prodId+"/mpp?wosid="+woSID;
	}
	else
	{
		var addToCartLink="/wa/4/40/"+catId+"/"+prodId+".html";

	}
document.write("<div style='width:280px;border:1px solid #3AA267;margin:10px 0px 10px 0px;padding:2px;float:left;'>");
document.write("<img  style='float:left;margin-right:2px' alt='Toastie-Toes Offer' src='/ires/53/WW/wwProductImages/ToastiToes-sml.jpg'>");
document.write("<p style='font-weight:bold;font-size:12pt;color:#C6420E;'>Save &pound;8.15.......<\/p>");
document.write("<p style='color:#006699'>Don't get cold feet.<br><br><b>Add<\/b> 10");
document.write("<a href='http://www.wellie-web.co.uk/wa/2/40/1845-Foot-Warmers/32039-Toasti-Toes.html'> Toastie-Toes</a> for just <b>&pound;11.75<\/b>");
document.write("<a class='productListAddToBasketLink' href='"+addToCartLink+"'>Add To Cart<\/a><\/p><\/div>");
return;

}


//-------------------------------------END SPECIAL OFFERS--------------------------















function getSO(){

var SORegex=/SO(.+)/i;
var elements=document.getElementsByTagName("b");		
		for (var i = 0; i < elements.length; i++) 
			{
				var spanText=elements[i].childNodes.item(0).data;
				if(SORegex.test(spanText))
					{document.write("<input type='hidden' name='so' value='"+spanText+"'>");}
							
			};
	}


function getSOPPal(){
var SORegex=/SO\W*(.+),/i;
var element=document.getElementById("paymentStatusDiv");
for (var i = 0; i < element.childNodes.length; i++) 
	{
	testText=element.childNodes.item(i).data;
	if(SORegex.test(testText))
		{var match=SORegex.exec(testText);
		document.write("<input type='hidden' name='so' value='"+match[1]+"'>");
		}
			
	};
}



function writeImageFlash(id){
pageId=id;

var so = new SWFObject("/ires/53/lcc/lccflash/p-slides-v3.swf?xmlFile=/ires/53/lcc/lccflash/images.xml&setId="+pageId, "flashView", "100%", "100%", "6", "#bdc67f");
so.write("res19305");
}

function setFlashWidth(divid, newW){
	var node=document.getElementById(divid);
	var parentNode=node.parentNode;
	var grandParentNode=parentNode.parentNode;
	node.style.width = newW+"px";
	parentNode.style.width = newW+"px";
	grandParentNode.style.width = newW+"px";
	
}
function setFlashHeight(divid, newH){
	var node=document.getElementById(divid);
	var parentNode=node.parentNode;
	var grandParentNode=parentNode.parentNode;
	node.style.height = newH+"px";
	parentNode.style.height = newH+20+"px";
	grandParentNode.style.height = newH+"px";	
}
function setFlashSize(divid, newW, newH){
	setFlashWidth(divid, newW);
	setFlashHeight(divid, newH);
}