
function MM_preloadImages(){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(){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){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);if(!x&&d.getElementById)x=d.getElementById(n);return x;}
function MM_swapImage(){var i,j=0,x,a=MM_swapImage.arguments;document.MM_sr=new Array;for(i=0;i<(a.length-2);i+=3)
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 postValidate(refForm){strError="";var io=document.getElementById('internetonly').checked;if(refForm.vendor_name.value.length==0){strError+=" - Please enter the Vendor Name\n";}
if((refForm.vendor_postcode1.value.length==0)&&(!io)){strError+=" - Please enter the Vendor Postcode\n";}
if(refForm.title.value.length==0){strError+=" - Please enter the Promotion Title\n";}
if((refForm.logo.value.length>1)&&(!check_extension(refForm.logo.value))){strError+=" - The filetype for your logo is invalid. Please use images with JPEG or JPG extensions\n";}
if(refForm.fullinfo.value.length==0){strError+=" - Please enter a description\n";}
if(!refForm.terms.checked){strError+=" - You must agree to the terms and conditions\n";}
if((refForm.vendor_postcode1.value.length>0)&&(!io)){var ok=false;for(i=0;i<arrValidPC.length;i++){if(refForm.vendor_postcode1.value.toLowerCase()==arrValidPC[i].toLowerCase()){var ok=true;break;}}
if(!ok){strError+=" - Invalid postcode entered\n";}}
if(strError.length>0){alert(strError);return false;}else{return true;}}
function postValidate_1(refForm){strError="";if(document.forms[0].title.value.length==0){strError+=" - Please enter the Promotion Title\n";}
if((document.forms[0].logo.value.length>1)&&(!check_extension(refForm.logo.value))){strError+=" - The filetype for your logo is invalid. Please use images with JPEG or JPG extensions\n";}
if(document.forms[0].fullinfo.value.length==0){strError+=" - Please enter a Description\n";}
if(strError.length>0){alert(strError);return false;}else{return true;}}
function postValidate_2(refForm){strError="";if(refForm.title.value.length==0){strError+=" - Please enter the Product Title\n";}
if((refForm.logo.value.length>1)&&(!check_extension(refForm.logo.value))){strError+=" - The filetype for your image is invalid. Please use images with JPEG or JPG extensions\n";}
if(strError.length>0){alert(strError);return false;}else{return true;}}
function postValidate_3(refForm){strError="";var io=document.getElementById('internetonly').checked;if((refForm.vendor_postcode1.value.length==0)&&(!io)){strError+=" - Please enter a postcode or tick the Internet only box\n";}
if(!refForm.terms.checked){strError+=" - You must agree to the terms and conditions\n";}
if((refForm.vendor_postcode1.value.length>0)&&(!io)){var ok=false;for(i=0;i<arrValidPC.length;i++){if(refForm.vendor_postcode1.value.toLowerCase()==arrValidPC[i].toLowerCase()){var ok=true;break;}}
if(!ok){strError+=" - Invalid postcode entered\n";}}
if(strError.length>0){alert(strError);return false;}else{return true;}}
function check_extension(strWhat){var arrAllowed=["jpeg","jpg"];for(i=0;i<=arrAllowed.length;i++){if(strWhat.toLowerCase().indexOf(arrAllowed[i])>0){return true;}}
return false;}
function questionValidate(refForm){strError="";if(refForm.txt.value.length==0){strError+=" - Please enter a message\n";}
if(strError.length>0){alert(strError);return false;}else{return true;}}
function checkContinous(ref){if(ref){document.forms[0].end_day.disabled=true;document.forms[0].end_month.disabled=true;document.forms[0].end_year.disabled=true;}else{document.forms[0].end_day.disabled=false;document.forms[0].end_month.disabled=false;document.forms[0].end_year.disabled=false;}}
function checkPostCode(toCheck){if(toCheck.length==0){return true;}
toCheck=toCheck.toUpperCase();for(i=0;i<arrValidPC.length;i++){if(toCheck.indexOf(arrValidPC[i])>-1){return true;break;}}
alert("Invalid Postcode");return false;}
function postPromotionDisable(bSetting){fields=["vendor_address1","vendor_address2","vendor_town","vendor_postcode","vendor_postcode2"];for(var i=0;i<fields.length;i++){ref=document.getElementById(fields[i]);if(bSetting){ref.disabled=true;ref.value="";ref.style.backgroundColor='#cccccc';}else{ref.disabled=false;ref.style.backgroundColor='transparent';}}}
function checkSearchForm(){if(checkPostCode(document.getElementById('search').postcode.value)){document.getElementById('search').submit();}
return false;}
function checkSigninform(){document.getElementById('signin').submit();}
function checkforenter(functiontocall){document.onkeydown=function(e){var code;if(!e)var e=window.event;if(e.keyCode)code=e.keyCode;else if(e.which)code=e.which;if(code==13){eval(functiontocall+"()");}}}
function LimitText(f,c,w){if(f.value.length>c){f.value=f.value.substring(0,c);}
w.value=c-f.value.length;}
function navigateCalendar(month,year){var url="index_calendar_get.php?month="+month+"&year="+year;if(window.XMLHttpRequest){req=new XMLHttpRequest();}else if(window.ActiveXObject){req=new ActiveXObject("Microsoft.XMLHTTP");}
req.open("GET",url,true);req.onreadystatechange=callbackCalendar;req.send(null);}
function callbackCalendar(){if(req.readyState==4){if(req.status==200){response=req.responseText;document.getElementById("calendar").innerHTML=response;}else{alert("There was a problem retrieving the data:\n"+req.statusText);}}}
function productPopup(iProductId){var refWindow=window.open("promotion_detail_product_image.php?id="+iProductId,"Product","left=30,top=30,resizable=1,scrollbars=no,status=no,width=1,height=1");}
function productPopupresizeWinTo(idOfDiv){var oH=document.getElementById(idOfDiv);var oW=oH.clip?oH.clip.width:oH.offsetWidth;var oH=oH.clip?oH.clip.height:oH.offsetHeight;if(!oH){return false;}
var x=window;x.resizeTo(oW+200,oH+200);var myW=0,myH=0,d=x.document.documentElement,b=x.document.body;if(x.innerWidth){myW=x.innerWidth;myH=x.innerHeight;}
else if(d&&d.clientWidth){myW=d.clientWidth;myH=d.clientHeight;}
else if(b&&b.clientWidth){myW=b.clientWidth;myH=b.clientHeight;}
if(window.opera&&!document.childNodes){myW+=16;}
oW+=10;oH+=10;x.resizeTo(oW+((oW+200)-myW),oH+((oH+200)-myH));x.focus();}
function MM_showHideLayers(){var i,p,v,obj,args=MM_showHideLayers.arguments;for(i=0;i<(args.length-2);i+=3)
with(document)if(getElementById&&((obj=getElementById(args[i]))!=null)){v=args[i+2];if(obj.style){obj=obj.style;v=(v=='show')?'visible':(v=='hide')?'hidden':v;}
obj.visibility=v;}}
function byId(objId){return(document.getElementById(objId));}
function showLbSaveProduct(){byId("saveproductWrapper").style.display='block';byId("saveproductShadow").style.display='block';byId("saveproductBox").style.display='block';}
function hideLbSaveProduct(){byId("saveproductWrapper").style.display='none';byId("saveproductShadow").style.display='none';byId("saveproductBox").style.display='none';}
function lbAddToMyList(prodId){try{var id=prodId.replace(/[^0-9]+/,"");if(prodId==id){var src="/lookbook/addtomylist.php?html=1&prodID="+prodId;if($(document).find("div#saveproductBox").length==0){var saveproductBox='<div id="saveproductWrapper" style="display:none; height:100%; min-height: 100%; " > '+'<div id="saveproductShadow" style="position:fixed; display:block; '+' top:0px; left:0px; width:100%; height:100%; min-height: 100%; z-index:999999998; '+' background:url(/lookbook/images/overlay_background.png) repeat; opacity: .30; filter:Alpha(Opacity=30); " ></div> '+' <div id="saveproductBox" '+' style="position:fixed; '+' display:block; background:url(/lookbook/images/save_product_box.png) no-repeat top left; width:308px; height:208px; z-index:999999999; top:50%; left:50%; margin-top: -150px; margin-left: -150px; " > '+' <div id="saveproductBoxClose" '+' style="position:absolute; display:block; top:8px; left:279px; width:18px; height:18px; cursor: pointer; border: 0px solid #eee;" '+' onclick="hideLbSaveProduct();" onmouseover="this.style.borderWidth=\'1px\';" onmouseout="this.style.borderWidth=\'0px\';" > '+' </div> <div id="saveproductBoxContent" '+' style="position:absolute; display:block; '+' top:53px; left:4px; width:300px; height:150px; overflow:hidden;" > '+' <iframe id="saveproductFrame" name="saveproductFrame" '+' src="about:blank" width="298px" height="145px" scrolling="no" style="border:0px blue solid;" frameborder="0" ></iframe> '+' </div> </div> </div> ';$("body").append(saveproductBox);}if($("#saveproductFrame").attr("src")!=src){byId("saveproductFrame").style.display='none';showLbSaveProduct();$("div#saveproductBoxContent").find("p").remove();$("div#saveproductBoxContent").prepend('<p style="font-size:18px; font-weight:bold; margin:10px 0px 0px 35px;"> loading...</p>');$("#saveproductFrame").attr("src",src).one("load",function(){$("div#saveproductBoxContent").find("p").remove();byId("saveproductFrame").style.display='block';});}}}catch(err){hideLbSaveProduct();return true;}return false;}
function show_saAddProduct(){byId("saAddProductWrapper").style.display='block';byId("saAddProductShadow").style.display='block';byId("saAddProductBox").style.display='block';}
function hide_saAddProduct(){byId("saAddProductWrapper").style.display='none';byId("saAddProductShadow").style.display='none';byId("saAddProductBox").style.display='none';}
function saAddProduct(prodId){try{var id=prodId.replace(/[^0-9]+/,"");if(prodId==id){var src="/salesalert_addprod.php?prodID="+prodId;if($(document).find("div#saAddProductBox").length==0){var saAddProductBox='<div id="saAddProductWrapper" style="display:none; height:100%; min-height: 100%; " > '+'<div id="saAddProductShadow" style="position:fixed; display:block; '+' top:0px; left:0px; width:100%; height:100%; min-height: 100%; z-index:999999998; '+' background:url(/images/overlay_background.png) repeat; opacity: .30; filter:Alpha(Opacity=30); " ></div> '+' <div id="saAddProductBox" '+' style="position:fixed; '+' display:block; background:url(/images/save_sale_alert_box.png) no-repeat top left; width:308px; height:208px; z-index:999999999; top:50%; left:50%; margin-top: -150px; margin-left: -150px; " > '+' <div id="saAddProductBoxClose" '+' style="position:absolute; display:block; top:8px; left:279px; width:18px; height:18px; cursor: pointer; border: 0px solid #eee;" '+' onclick="hide_saAddProduct();" onmouseover="this.style.borderWidth=\'1px\';" onmouseout="this.style.borderWidth=\'0px\';" > '+' </div> <div id="saAddProductBoxContent" '+' style="position:absolute; display:block; '+' top:53px; left:4px; width:300px; height:150px; overflow:hidden;" > '+' <iframe id="saAddProductFrame" name="saAddProductFrame" '+' src="about:blank" width="298px" height="145px" scrolling="no" style="border:0px blue solid;" frameborder="0" ></iframe> '+' </div> </div> </div> ';$("body").append(saAddProductBox);}if($("#saAddProductFrame").attr("src")!=src){byId("saAddProductFrame").style.display='none';show_saAddProduct();$("div#saAddProductBoxContent").find("p").remove();$("div#saAddProductBoxContent").prepend('<p style="font-size:18px; font-weight:bold; margin:10px 0px 0px 35px;"> loading...</p>');$("#saAddProductFrame").attr("src",src).one("load",function(){$("div#saAddProductBoxContent").find("p").remove();byId("saAddProductFrame").style.display='block';});}}}catch(err){hide_saAddProduct();return true;}return false;}