findCookie();

function enableSearch() {
if (document.SearchForm.view.value == "") {
document.SearchForm.button.disabled = true;
} else {
document.SearchForm.button.disabled = false;
}}

function Bookmark() {
doRefresh();
url = this.location; who = document.title;
window.external.AddFavorite(url,who);
}

function SetHomepage(itemObj) {
itemObj.style.behavior = "url(#default#homepage)";
itemObj.setHomepage(location.href);
}

function checkemails() {
friendsemailval = document.sendpageform.friendsemail.value.search("@");
if (friendsemailval == -1) {friendsemailchecked = "Please enter a valid email address in the Friends Email field\n";} else {friendsemailchecked = "";}
youremailval = document.sendpageform.youremail.value.search("@");
if (youremailval == -1) {youremailchecked = "Please enter a valid email address in the Your Email field\n";} else {youremailchecked = "";}
if (document.sendpageform.friendsemail.value == document.sendpageform.youremail.value) {sameemailchecked = "The Friends Email and Your Email are the same. Please change one email address";} else {sameemailchecked = "";}
if (friendsemailchecked != "" & youremailchecked != "") {alert(friendsemailchecked + youremailchecked); return (false);} //DO NOT DELETE
else if (friendsemailchecked != "" | youremailchecked != "" | sameemailchecked != "") {alert(friendsemailchecked + youremailchecked + sameemailchecked); return (false);} //DO NOT DELETE
else {return (true);}
}

function checklist() {
mailinglistval = document.mailinglistform.mailinglist.value.search("@");
if (mailinglistval == -1) {alert("Please enter a valid email address.");
return (false);
} else {return (true);}
}

function checkprom(Curr) {
if (dts("Cancel") > -1) {
return(true);
} else {
document.getElementById("ukbannersiframe").src = "https://www.ukbanners.com";
if (document.PromotionForm.promcode.value != document.cookie.substring(document.cookie.indexOf("prom"),nameend).split("%2C")[1]) {
alert('The promotion code has not been calculated.\nPlease click Calculate before proceeding to the checkout.');
return(false);
} else {
//FreeGift Changes Start
if (Curr=="g") {JSCurrencySymbol="£"; FGProdPrice=5;}
else if (Curr=="e") {JSCurrencySymbol="€"; FGProdPrice=5;}
else if (Curr=="u") {JSCurrencySymbol="$"; FGProdPrice=10;}
FGtoEndcookie=document.cookie.substring(document.cookie.indexOf("prom"),nameend).split("%2C");
cookieFGQual=FGtoEndcookie[3];
if (FGtoEndcookie[4]!=null) {
cookieFGProd=FGtoEndcookie[4].split("fg")[0]+FGtoEndcookie[4].split("fg")[1];
if (cookieFGProd.search("gift")>-1) {
cookieFGProd=cookieFGProd.split("gift")[0]+cookieFGProd.split("gift")[1];
}
cookieFGQualValid=FGtoEndcookie[5];
} else {cookieFGProd=""; cookieFGQualValid="";}
if (cookieFGQual=="yes") {
if (cookieFGQual=="yes" & cookieFGProd=="") {
input_box = confirm('A free gift has not been collected.\nPlease enter a product code and click Collect before proceeding to the checkout.\nIf you click OK to continue the free gift will not be added to the order.');
if (input_box==true) {return(true);} else {return(false);}
} else if (document.CollectForm.promcode.value != cookieFGProd) {
input_box = confirm('The free gift product code has not been collected.\nPlease click Collect before proceeding to the checkout.\nIf you click OK to continue the free gift will not be added to the order.');
if (input_box==true) {return(true);} else {return(false);}
} else if (cookieFGQual == "yes" & cookieFGQualValid == "nocode") {
input_box = confirm('The product code entered is not valid. No product is associated with this code.\nIf you click OK to continue the free gift will not be added to the order.');
if (input_box==true) {return(true);} else {return(false);}
} else if (cookieFGQual == "yes" & cookieFGQualValid == "nosup") {
input_box = confirm('A jewellery supplies product cannot be collected as a gift. Please enter another jewellery free gift code.\nIf you click OK to continue the free gift will not be added to the order.');
if (input_box==true) {return(true);} else {return(false);}
} else if (cookieFGQual == "yes" & cookieFGQualValid == "nostock") {
input_box = confirm('The free gift cannot be collected.\nThe quantity in the basket is at the maximum or there is no stock available.\nIf you click OK to continue the free gift will not be added to the order.');
if (input_box==true) {return(true);} else {return(false);}
} else if (cookieFGQual == "yes" & cookieFGQualValid == "noprice") {
input_box = confirm('The free gift collected is greater than '+JSCurrencySymbol+FGProdPrice+' in value.\nIf you click OK to continue the free gift will not be added to the order.\nPlease enter another free gift code with a value up to '+JSCurrencySymbol+FGProdPrice+'.');
if (input_box==true) {return(true);} else {return(false);}
//FreeGift Changes End
} else {
return(true);
}}}}}

function subjectcharcount(start) {
subjectchar = document.sendpageform.subject.value.length + 1;
subjectcharval = 50 - subjectchar + start;
if (subjectcharval > -1 ) {
if (subjectcharval == 1) {
document.getElementById("SubjectChars").innerHTML = "<font size=1 face=Arial, Helvetica, sans-serif>1 character left</font>";
} else {
document.getElementById("SubjectChars").innerHTML = "<font size=1 face=Arial, Helvetica, sans-serif>" + subjectcharval + " characters left</font>";
}}}

function commentscharcount(start) {
commentschar = document.sendpageform.comments.value.length + 1;
commentscharval = 255 - commentschar + start;
if (commentscharval > -1) {document.getElementById("CommentsChars").innerHTML = "<font size=1 face=Arial, Helvetica, sans-serif>" + commentscharval + " characters left</font>";}
if (commentscharval == 1) {document.getElementById("CommentsChars").innerHTML = "<font size=1 face=Arial, Helvetica, sans-serif>1 character left</font>";}
if (commentscharval < 0) {document.getElementById("CommentsChars").innerHTML = "<font size=1 face=Arial, Helvetica, sans-serif>0 characters left</font>";}
if (commentschar >= 256) {document.sendpageform.comments.value = document.sendpageform.comments.value.substring(0,255);}
}

function linktitlecharcount(start) {
linktitlechar = document.LinkForm.LinkTitle.value.length + 1;
linktitlecharval = 80 - linktitlechar + start;
if (linktitlecharval > -1 ) {
if (linktitlecharval == 1) {
document.getElementById("LinkTitleChars").innerHTML = "1&nbsp;char&nbsp;left&nbsp;&nbsp;";
} else {
document.getElementById("LinkTitleChars").innerHTML = linktitlecharval + "&nbsp;chars&nbsp;left&nbsp;&nbsp;";
}}}

function linkdesccharcount(start) {
linkdescchar = document.LinkForm.LinkDesc.value.length + 1;
linkdesccharval = 250 - linkdescchar + start;
if (new String(linkdesccharval).length == 1) {linkspacer = "&nbsp;&nbsp;";} else if (new String(linkdesccharval).length == 2) {linkspacer = "&nbsp;";} else {linkspacer = "";}
if (linkdesccharval > -1) {document.getElementById("LinkDescChars").innerHTML = linkspacer + linkdesccharval + "&nbsp;chars&nbsp;left&nbsp;&nbsp;";}
if (linkdesccharval == 1) {document.getElementById("LinkDescChars").innerHTML = "1&nbsp;char&nbsp;left&nbsp;&nbsp;";}
if (linkdesccharval < 0) {document.getElementById("LinkDescChars").innerHTML = "0&nbsp;chars&nbsp;left&nbsp;&nbsp;";}
if (linkdescchar >= 251) {document.LinkForm.LinkDesc.value = document.LinkForm.LinkDesc.value.substring(0,250);}
}

function CheckLinkData() {
createYourTitle();createYourDescription();createYourURL();
CheckLinkDataString = "";
if (document.LinkForm.LinkName.value == "") {CheckLinkDataString = "Full Name\n"; document.getElementById("tdFullNameText").background = "shop/checkdata1.gif"; document.getElementById("tdFullName").background = "shop/checkdata5.gif";}
if (document.LinkForm.LinkEmail.value.search("@") == -1) {CheckLinkDataString = CheckLinkDataString + "Email\n"; document.getElementById("tdEmailText").background = "shop/checkdata1.gif"; document.getElementById("tdEmail").background = "shop/checkdata5.gif";}
if (document.LinkForm.LinkTitle.value == "") {CheckLinkDataString = CheckLinkDataString + "Link Title\n"; document.getElementById("tdLinkTitleText").background = "shop/checkdata1.gif"; document.getElementById("tdLinkTitle").background = "shop/checkdata5.gif";}
if (document.LinkForm.LinkDesc.value == "" | document.LinkForm.LinkDesc.value == " ") {CheckLinkDataString = CheckLinkDataString + "Description\n"; document.getElementById("tdLinkDescText").background = "shop/checkdata6.gif"; document.getElementById("tdLinkDesc").background = "shop/checkdata7.gif";}
if (document.LinkForm.LinkURL.value.split("http://")[1] == "") {CheckLinkDataString = CheckLinkDataString + "Link URL\n"; document.getElementById("tdLinkURLText").background = "shop/checkdata1.gif"; document.getElementById("tdLinkURL").background = "shop/checkdata5.gif";}
if (typeof document.LinkForm.LinkURL.value.split("http://")[1] == "undefined") {CheckLinkDataString = CheckLinkDataString + "Link URL including http://\n"; document.getElementById("tdLinkURLText").background = "shop/checkdata1.gif"; document.getElementById("tdLinkURL").background = "shop/checkdata5.gif";}
if (document.LinkForm.LinkRecipURL.value.split("http://")[1] == "") {CheckLinkDataString = CheckLinkDataString + "Recip. URL\n"; document.getElementById("tdLinkRecipURLText").background = "shop/checkdata1.gif"; document.getElementById("tdLinkRecipURL").background = "shop/checkdata5.gif";}
if (typeof document.LinkForm.LinkRecipURL.value.split("http://")[1] == "undefined") {CheckLinkDataString = CheckLinkDataString + "Recip. URL including http://\n"; document.getElementById("tdLinkRecipURLText").background = "shop/checkdata1.gif"; document.getElementById("tdLinkRecipURL").background = "shop/checkdata5.gif";}
if (document.LinkForm.Category.value == "select") {CheckLinkDataString = CheckLinkDataString + "Category\n"; document.getElementById("tdCategoryText").background = "shop/checkdata1.gif"; document.getElementById("tdCategory").background = "shop/checkdata8.gif";}

if (document.LinkForm.LinkName.value != "" & document.getElementById("tdFullNameText").background == "shop/checkdata1.gif") {document.getElementById("tdFullNameText").background = ""; document.getElementById("tdFullName").background = "";}
if (document.LinkForm.LinkEmail.value.search("@") > -1 & document.getElementById("tdEmailText").background == "shop/checkdata1.gif") {document.getElementById("tdEmailText").background = ""; document.getElementById("tdEmail").background = "";}
if (document.LinkForm.LinkTitle.value != "" & document.getElementById("tdLinkTitleText").background == "shop/checkdata1.gif") {document.getElementById("tdLinkTitleText").background = ""; document.getElementById("tdLinkTitle").background = "";}
if (document.LinkForm.LinkDesc.value != "" & document.LinkForm.LinkDesc.value != " " & document.getElementById("tdLinkDescText").background == "shop/checkdata6.gif") {document.getElementById("tdLinkDescText").background = ""; document.getElementById("tdLinkDesc").background = "";}
if (document.LinkForm.LinkURL.value.search("http://") > -1 & document.LinkForm.LinkURL.value.split("http://")[1] != "" & document.getElementById("tdLinkURLText").background == "shop/checkdata1.gif") {document.getElementById("tdLinkURLText").background = ""; document.getElementById("tdLinkURL").background = "";}
if (document.LinkForm.LinkRecipURL.value.search("http://") > -1 & document.LinkForm.LinkRecipURL.value.split("http://")[1] != "" & document.getElementById("tdLinkRecipURLText").background == "shop/checkdata1.gif") {document.getElementById("tdLinkRecipURLText").background = ""; document.getElementById("tdLinkRecipURL").background = "";}
if (document.LinkForm.Category.value != "select" & document.getElementById("tdCategoryText").background == "shop/checkdata1.gif") {document.getElementById("tdCategoryText").background = ""; document.getElementById("tdCategory").background = "";}

if (CheckLinkDataString != "") {CheckLinkDataString = "The following fields need to be completed to submit a link exchange:\n\n" + CheckLinkDataString;}

if (CheckLinkDataString != "") {
alert(CheckLinkDataString); //DO NOT DELETE
return (false);
} else {
//New Link Exchange
document.LinkForm.LinkDesc1.value = document.getElementById("YourLinkDesc1").innerHTML;
document.LinkForm.LinkDesc2.value = document.getElementById("YourLinkDesc2").innerHTML.substring(4,document.getElementById("YourLinkDesc2").innerHTML.length);
document.LinkForm.LinkDesc3.value = document.getElementById("YourLinkDesc3").innerHTML.substring(4,document.getElementById("YourLinkDesc3").innerHTML.length);
//New Link Exchange
return (true);
}}

function createYourTitle() {
if (document.getElementById("LinkTitle").value != "") {
document.getElementById("YourLinkTitle").innerHTML = document.getElementById("LinkTitle").value;
} else {
document.getElementById("YourLinkTitle").innerHTML = "Link Title";
}}

function createYourDescription() {
document.getElementById("YourLinkDesc1").innerHTML = "";
document.getElementById("YourLinkDesc2").innerHTML = "";
document.getElementById("YourLinkDesc3").innerHTML = "";
if (document.getElementById("LinkDesc").value != "") {
LinkDescValue = document.getElementById("LinkDesc").value;
while (LinkDescValue.search("<br>") > -1) {
LinkDescValue0 = LinkDescValue.substring(0,LinkDescValue.search("<br>"));
LinkDescValue1 = LinkDescValue.substring(LinkDescValue.search("<br>")+4,LinkDescValue.length);
LinkDescValue = LinkDescValue0 + " " + LinkDescValue1;
}
while (LinkDescValue.search("<a href") > -1) {
LinkDescValue0 = LinkDescValue.substring(0,LinkDescValue.search("<a href"));
LinkDescValue1 = LinkDescValue.substring(LinkDescValue.search("<a href")+7,LinkDescValue.length);
LinkDescValue = LinkDescValue0 + " " + LinkDescValue1;
}
while (LinkDescValue.search("</a>") > -1) {
LinkDescValue0 = LinkDescValue.substring(0,LinkDescValue.search("</a>"));
LinkDescValue1 = LinkDescValue.substring(LinkDescValue.search("</a>")+4,LinkDescValue.length);
LinkDescValue = LinkDescValue0 + " " + LinkDescValue1;
}
while (LinkDescValue.search("<strong>") > -1) {
LinkDescValue0 = LinkDescValue.substring(0,LinkDescValue.search("<strong>"));
LinkDescValue1 = LinkDescValue.substring(LinkDescValue.search("<strong>")+8,LinkDescValue.length);
LinkDescValue = LinkDescValue0 + " " + LinkDescValue1;
}
while (LinkDescValue.search("</strong>") > -1) {
LinkDescValue0 = LinkDescValue.substring(0,LinkDescValue.search("</strong>"));
LinkDescValue1 = LinkDescValue.substring(LinkDescValue.search("</strong>")+9,LinkDescValue.length);
LinkDescValue = LinkDescValue0 + " " + LinkDescValue1;
}
while (LinkDescValue.search("<b>") > -1) {
LinkDescValue0 = LinkDescValue.substring(0,LinkDescValue.search("<b>"));
LinkDescValue1 = LinkDescValue.substring(LinkDescValue.search("<b>")+3,LinkDescValue.length);
LinkDescValue = LinkDescValue0 + " " + LinkDescValue1;
}
while (LinkDescValue.search("</b>") > -1) {
LinkDescValue0 = LinkDescValue.substring(0,LinkDescValue.search("</b>"));
LinkDescValue1 = LinkDescValue.substring(LinkDescValue.search("</b>")+4,LinkDescValue.length);
LinkDescValue = LinkDescValue0 + " " + LinkDescValue1;
}
if (LinkDescValue.search(" ") == -1) {
LDVCounter = 0; LinkDescValueNew = "";
while (LinkDescValue.substring(LDVCounter,LDVCounter+6) != "") {
LinkDescValueNew = LinkDescValueNew + LinkDescValue.substring(LDVCounter,LDVCounter+6) + " ";
LDVCounter = LDVCounter + 6;
}
LinkDescValue = LinkDescValueNew;
}
YourLinkDescription1 = LinkDescValue.substring(0,1);
document.getElementById("YourLinkDesc1").innerHTML = YourLinkDescription1;
YLDValue = 0;
YourLinkDesc1Greater = 0;
YourLinkDesc2Greater = 0;
YourLinkDesc3Greater = 0;
createDescLine1();
} else {
document.getElementById("YourLinkDesc1").innerHTML = "Link Description";
}}

function createDescLine1() {
while (document.getElementById("YourLinkDescImage1").offsetLeft < 500 & LinkDescValue.substring(YLDValue,YLDValue+1) != "" & YourLinkDesc1Greater == 0) {
while (LinkDescValue.substring(YLDValue,YLDValue+1) != " " & LinkDescValue.substring(YLDValue,YLDValue+1) != "") {
YLDValue = YLDValue + 1;
}
YourLinkDescription1 = LinkDescValue.substring(0,YLDValue);
document.getElementById("YourLinkDesc1").innerHTML = YourLinkDescription1;
YLDValue = YLDValue + 1;
}
if (document.getElementById("YourLinkDescImage1").offsetLeft > 545) {
YourLinkDesc1Greater = 1;
YLDValue = YourLinkDescription1.length;
while (YourLinkDescription1.substring(YLDValue-1,YLDValue) != " " & YourLinkDescription1.substring(YLDValue-1,YLDValue) != "\n" & YLDValue > 0) {// & YourLinkDescription1.substring(YLDValue-1,YLDValue) != "") {
YLDValue = YLDValue - 1;
}
YourLinkDescription1 = LinkDescValue.substring(0,YLDValue);
document.getElementById("YourLinkDesc1").innerHTML = YourLinkDescription1;
document.getElementById("YourLinkDesc2").innerHTML = "<br>";
Line1YLDValue = YLDValue;
createDescLine2();
}
if (document.getElementById("YourLinkDescImage1").offsetLeft >= 500 & document.getElementById("YourLinkDescImage1").offsetLeft < 551 & LinkDescValue.substring(YLDValue,YLDValue+1) != "") {
Line1YLDValue = YLDValue;
document.getElementById("YourLinkDesc2").innerHTML = "<br>";
createDescLine2();
}
}

function createDescLine2() {
if (document.getElementById("YourLinkDescImage2").offsetLeft < 500 & LinkDescValue.substring(YLDValue,YLDValue+1) != "" & YourLinkDesc2Greater == 0) {
while (LinkDescValue.substring(YLDValue,YLDValue+1) != " " & LinkDescValue.substring(YLDValue,YLDValue+1) != "") {
YLDValue = YLDValue + 1;
}
YourLinkDescription2 = LinkDescValue.substring(Line1YLDValue,YLDValue);
document.getElementById("YourLinkDesc2").innerHTML = "<br>" + YourLinkDescription2;
YLDValue = YLDValue + 1;
createDescLine2();
}
if (document.getElementById("YourLinkDescImage2").offsetLeft > 545) {
YourLinkDesc2Greater = 1;
YLDValue = YLDValue - Line1YLDValue;
while (YourLinkDescription2.substring(YLDValue-1,YLDValue) != " " & YourLinkDescription2.substring(YLDValue-1,YLDValue) != "\n" & YLDValue > 0) {// & YourLinkDescription1.substring(YLDValue-1,YLDValue) != "") {
YLDValue = YLDValue - 1;
}
YourLinkDescription2 = YourLinkDescription2.substring(0,YLDValue);
document.getElementById("YourLinkDesc2").innerHTML = "<br>" + YourLinkDescription2;
document.getElementById("YourLinkDesc3").innerHTML = "<br>";
YLDValue = YLDValue + Line1YLDValue;
Line2YLDValue = YLDValue;
createDescLine3();
}
if (document.getElementById("YourLinkDescImage2").offsetLeft >= 500 & document.getElementById("YourLinkDescImage2").offsetLeft < 551 & LinkDescValue.substring(YLDValue,YLDValue+1) != "") {
Line2YLDValue = YLDValue;
document.getElementById("YourLinkDesc3").innerHTML = "<br>";
createDescLine3();
}
}

function createDescLine3() {
if (document.getElementById("YourLinkDescImage3").offsetLeft < 500 & LinkDescValue.substring(YLDValue,YLDValue+1) != "" & YourLinkDesc3Greater == 0) {
while (LinkDescValue.substring(YLDValue,YLDValue+1) != " " & LinkDescValue.substring(YLDValue,YLDValue+1) != "") {
YLDValue = YLDValue + 1;
}
YourLinkDescription3 = LinkDescValue.substring(Line2YLDValue,YLDValue);
document.getElementById("YourLinkDesc3").innerHTML = "<br>" + YourLinkDescription3;
YLDValue = YLDValue + 1;
createDescLine3();
}
if (document.getElementById("YourLinkDescImage3").offsetLeft > 545) {
YourLinkDesc3Greater = 1;
YLDValue = YLDValue - Line2YLDValue;
while (YourLinkDescription3.substring(YLDValue-1,YLDValue) != " " & YourLinkDescription3.substring(YLDValue-1,YLDValue) != "\n" & YLDValue > 0) {// & YourLinkDescription1.substring(YLDValue-1,YLDValue) != "") {
YLDValue = YLDValue - 1;
}
YourLinkDescription3 = YourLinkDescription3.substring(0,YLDValue);
document.getElementById("YourLinkDesc3").innerHTML = "<br>" + YourLinkDescription3;
}
}

function createYourURL() {
LinkUndefined = 0;
if (document.getElementById("LinkURL").value.split("http://")[1] != "") {
if (document.getElementById("LinkURL").value.search("www.") > -1) {
LinkURL = document.getElementById("LinkURL").value.split("http://www.")[1];
if (typeof LinkURL == "undefined") {LinkUndefined = 1;}
} else {
LinkURL = document.getElementById("LinkURL").value.split("http://")[1];
}
if (LinkUndefined == 0) {
LinkURL = LinkURL.split("/")[0];
document.getElementById("YourLinkURL").innerHTML = "http://www." + LinkURL;
document.getElementById("hrefTitle").href = document.getElementById("LinkURL").value;
} else {
document.getElementById("YourLinkURL").innerHTML = "URL";
}
} else {
document.getElementById("YourLinkURL").innerHTML = "URL";
}}