var AlreadySub = false; function validateForm(){ if( AlreadySub ) return false; var err = 0; var errDesc = "Please complete the following:\n\n"; // Check Name if (document.logoform.name.value == ""){ err++; errDesc += err + ") Please enter your name\n"; } //Check Email if (document.logoform.email.value == ""){ err++; errDesc += err + ") Please enter your e-mail address\n"; }else{ atidx = document.logoform.email.value.indexOf("@"); dotidx = document.logoform.email.value.indexOf(".",atidx); // dot after the @ domchk = document.logoform.email.value.substr(atidx+1); //alert(domchk); if (atidx == -1 || dotidx == -1 || dotidx > (document.logoform.email.value.length-3) || document.logoform.email.value.length < 6 || (ValidTLD(domchk,tldArray)==-1)){ err++; errDesc += err + ") Please give a valid e-mail address\n"; } } //Check Website if (document.logoform.url.value == ""){ err++; errDesc += err + ") Please give your website address\n"; }else{ var lcUrl = document.logoform.url.value.toLowerCase(); //if (document.logoform.url.value.indexOf(".") == -1 || document.logoform.url.value.length < 11){ urldom = document.logoform.url.value; if(urldom.indexOf("http://")==0) urldom = urldom.substr(7); if(urldom.indexOf("https://")==0) urldom = urldom.substr(8); if(urldom.indexOf("/")>-1) urldom = urldom.substring(0,urldom.indexOf("/")); if(urldom.indexOf(":")>-1) urldom = urldom.substring(0,urldom.indexOf(":")); //alert(urldom); if (ValidTLD(urldom,tldArray)==-1){ err++; errDesc += err + ") Please enter a valid website address\n"; } else if(urldom.indexOf("@")>-1) { if(!confirm("Website addresses dont usually contain the @ symbol\nAre you sure?")) { return false; } //err++; //errDesc += err + ") Please enter a website address without an '@'\n"; } } // Check Radio Button if (document.logoform.logo.value < 0 ){ err++; errDesc += err + ") You must select a button style from the choice given\n"; } //alert("hello"); //Check to see if form should be submitted if (err > 0){ alert(errDesc); return false; }else{ if(!AlreadySub) { AlreadySub = true; document.logoform.action = "http://www.london-2012.co.uk/link/addref.php"; document.logoform.name.value = document.logoform.name.value; document.logoform.email.value = document.logoform.email.value; document.logoform.url.value = document.logoform.url.value; document.logoform.submit(); } return false; } } function ValidTLD(myString,tldArray){ var found=false; var myIndex=0; for(i=0;i1)&&(myString.lastIndexOf(tldArray[i])==(myString.length-tldArray[i].length))){ myIndex=myString.lastIndexOf(tldArray[i]); // alert ("found TLD match with "+tldArray[i]); return myIndex; } } //if(String(document.location).indexOf("nemesis")) // return 1; //else return -1; } var wdw = null; // sn = www.london-2012.co.uk function show_image( img , obj) { wdw = window.open("about:blank", "preview","height=10"); wdw = window.open("http://www.bid-london2012.co.uk/link/preview.php?img="+img, "preview"); wdw.focus(); }