
function remove(s,t){i=s.indexOf(t);r="";if(i==-1)return s;r+=s.substring(0,i)+remove(s.substring(i+t.length),t);return r;}
function checkDomain(nname){if(nname.length>3&&nname.length<63){for(var j=0;j<nname.length;j++)
{var dh=nname.charAt(j);var hh=dh.charCodeAt(0);if((hh>47&&hh<59)||(hh>64&&hh<91)||(hh>96&&hh<123)||hh==45)
{if((j==0||j==nname.length-1)&&hh==45){alert("Domain name should not begin or end with '-'");return false;}}
else{alert("Your domain name should not have special characters");return false;}}}else{alert("Your Domain name is too short/long");return false;}
return true;}
$(document).ready(function(){var clicked;var cart="";$("a").click(function(event){var link=$(this).attr("href");if(link.indexOf("#")<0&&link.indexOf(".jpg")<0&&link.indexOf("mailto:")<0)return false;});$("#javascriptmessage").hide();$("#pagevalidator").click(function(){window.location="http://validator.w3.org/check?uri=referer";});$("#pagemailto").click(function(){window.location="mailto:admin@method8.net";});$("#flickr").click(function(event){$("#contents").html("<img src='webimages/load.gif' alt='loading...' title='loading...' />");$.post("getflickrgallery","",function(data){if(data.indexOf("XXXERROR")<0){var contents="<img src='webimages/photogallery.jpg' alt='flickr photo gallery' title='flickr photo gallery' style='padding-top:10px'/><br /><br />";$("#contents").html(contents+data+"<br/>Are you interested in our photography? Or are you interested in adding flickr services to your website? Contact us!");}else{alert("oops, couldn't load the flickr gallery");}});});$(".flickrgalleryitem").livequery("click",function(event){var url=$(this).attr("alt");var id=$(this).attr("id");var title=$(this).attr("title");$("#flickrTitleArea").html(title);$("#flickrImageArea").html("<img src='"+url+"' style='width:320px;height:auto;vertical-align:top' title='"+title+"' alt='"+title+"' border='0'/>");$("#flickrCommentsArea").html("<img style='padding:20px' src='webimages/commentsload.gif' alt='loading...' title='loading...' />");$("#flickrphoto").modal({onOpen:function(dialog){dialog.overlay.fadeIn("slow",function(){dialog.container.slideDown("slow",function(){dialog.data.fadeIn("slow");});});},overlayClose:true,minHeight:600,maxHeight:600});$.post("getflickrcomments",{"id":id},function(data){if(data.indexOf("XXXERROR")<0){$("#flickrCommentsArea").html(data)}else{alert("oops, couldn't load the flickr image");}});});$("#login_email").click(function(event){$(this).attr("value","");});$("#login_ticket").click(function(event){$(this).attr("value","");});$(".twittmore").click(function(){$("#contents").html("<img src='webimages/load.gif' alt='loading...' title='loading...' />");$("#contents").load("factorytwitts.jsp");});$("#twitterfollowersnumber").livequery("click",function(event){$(this).slideUp("slow");$("#twitterfollowersids").slideDown("slow");});$("#twitterfollowersids").livequery("click",function(event){$(this).slideUp("slow");$("#twitterfollowersnumber").slideDown("slow");});$(".menulinks").click(function(){$(".menulinks").each(function(i){var text=$(this).attr("id");$(this).html(text);});var text=$(this).attr("id");$(this).html(text+"&nbsp;<img src='webimages/arrow.jpg' alt='-' title='-' />");clicked=$(this).attr("id");$("#mainimage").attr("src","webimages/"+text+".jpg");$("#contents").html("<img src='webimages/load.gif' alt='loading...' title='loading...' />");if(clicked!="contact"){$("#contents").load("contents?page="+clicked.toString());}else{$("#contents").load("contact.html");}});$(".otherinternal").livequery("click",function(data){var where=$(this).attr("id");$("#contents").load(where+".html");});$(".menulinks").hover(function(){var text=$(this).attr("id");$(this).html(text+"&nbsp;<img src='webimages/arrow.jpg' alt='-' title='-' />");},function(){if(clicked!=$(this).attr("id")){var text=$(this).attr("id");$(this).html(text);}});$(".biglinks").hover(function(){var name=$(this).attr("id").toString();$(this).attr("src","webimages/"+name+"arr.jpg");},function(){var name=$(this).attr("id").toString();$(this).attr("src","webimages/"+name+".jpg");});$(".biglinks").click(function(){var name=$(this).attr("id").toString();if(name=="help"||name=="showcase"){$("#contents").html("<img src='webimages/load.gif' alt='loading...' title='loading...' />");$("#contents").load("contents?page="+name.toString());}else{$("#contents").html("<img src='webimages/load.gif' alt='loading...' title='loading...' />");$("#contents").load("shop.html");}});$("#contactbutton").livequery("click",function(){var strg=$("#contactform").serialize();var name=$("#name").val();var email=$("#email").val();var subject=$("#subject").val();var message=$("#message").val();var valid=true;var checkedEmail=false;if(name==""||email==""||subject==""||message==""){alert("All fields are required!");checkedEmail=true;valid=false;}
if(checkedEmail==false&&(email.indexOf("@")<0||email.indexOf(".")<=0)){alert("E-mail address seems to be invalid");valid=false;}
if(valid==true){$("#contents").html("<img src='webimages/load.gif' alt='loading...' title='loading...' />");$.post("contact?"+strg,function(data){if(data.toString().indexOf("ERROR",0)<0){$("#contents").html("Thanks for contacting us. We will be back to you shortly.");}else{$("#contents").html("Sorry, an error has occured while processing your request. Please try again later");}});}});$("#checkdomain").livequery("click",function(){var name=$("#domainname").val();var tld=$("#tld").val();$("#domainresult").html("");if(checkDomain(name)){$.post("domainavail?domain="+name+"&tld="+tld,function(data){if(data.indexOf("NOT")>-1){$("#domainresult").html("<br/>"+data);}else{var domainOK="<br />The domain is available!<br /><br />";domainOK+="<b>Would you like to purchase this domain?</b><br />";domainOK+="<table style='padding:10px; width:100%'><tr><td width='160px'>";domainOK+="<input type='radio' name='offer1' class='options' value='-2'> No thanks";domainOK+="</td><td><input type='radio' name='offer1' class='options' value='2'> Yes please";domainOK+="</td></tr></table>";$("#domainresult").html(domainOK);}});}else{$("#domainname").val("");}});$(".options").livequery("click",function(){var product=$(this).attr("value");if(product=="2"||product=="3"||product=="4"||product=="5"||product=="6"||product=="9"){if(cart.indexOf(product)<0)cart+=product+"";if(product=="3"){cart=remove(cart,"4");cart=remove(cart,"9");}else if(product=="4"){cart=remove(cart,"3");cart=remove(cart,"9");}else if(product=="9"){cart=remove(cart,"3");cart=remove(cart,"4");}}else if(product=="X"){var secondoption=$("#applications").attr("value");if(secondoption=="0"){alert("Please choose one of the applications available and click again");$("#okradioapplic").attr("checked",false);}else cart+=secondoption+"";}else{if(product=="-2"){cart=remove(cart,"2");}else if(product=="-3"){cart=remove(cart,"3");cart=remove(cart,"4");cart=remove(cart,"9");}else if(product=="-5"){cart=remove(cart,"5");}else if(product=="-6"){cart=remove(cart,"6");}else if(product=="-X"){cart=remove(cart,"7");cart=remove(cart,"8");}}});$("#continueshop").livequery("click",function(){$("#allshop").slideUp("slow");var domainname=$("#domainname").val()+"."+$("#tld").val();$.post("getform",{"products":cart,"domain":domainname},function(data){if(data.indexOf("ERROR")<0){$("#buttonarea").html("<br /><b>Thank you for choosing method8solutions!</b><br /><br /> You will be asked to confirm your payment in the next step. <br /><br /> <table><tr><td>"+data+"</td><td><input type='button' value='Cancel' id='cancelpaypal'></td></tr></table>");}else{$("#allshop").slideDown("slow");$("#buttonarea").html("Sorry, an error has occured while processing. Please continue this transaction manually by sending an email to <a href='mailto:admin@method8.net'>admin@method8.net</a>");}});});$("#cancelpaypal").livequery("click",function(){$("#buttonarea").html("<input type='button' value='Calculate & Continue' id='continueshop' />");cart="";$("#allshop").slideDown("slow");$("#contents").load("shop.html");});$("#monitor").livequery("click",function(){$("#contents").html("<img src='webimages/load.gif' alt='loading...' title='loading...' />");$("#contents").load("contents",{"page":"monitor"});});});
