/* Copyright (C) Alex Kefford 2006-2008 */
var FCKeditorLoaded=false;mPosX=0;mPosY=0;preloadImages("../images/wait.gif","../images/tick.gif","../images/cross.gif");if(document.layers){window.captureEvents(Event.MOUSEMOVE);window.onmousemove=move}else{document.onmousemove=move}function move(e){var a=(document.compatMode&&document.compatMode!="BackCompat")?document.documentElement:document.body;var b=document.all?a.scrollLeft:pageXOffset;var c=document.all?a.scrollTop:pageYOffset;if(document.all){mPosX=window.event.clientX;mPosY=window.event.clientY}else{mPosX=e.pageX;mPosY=e.pageY}}function addNewVehicle(){var a="block";if(navigator.appName=="Netscape"){a="table-row"}document.getElementById("newVehicle2").style.display=a;document.getElementById("newVehicle3").style.display=a;document.getElementById("newVehicle1").style.display="none";document.getElementById("nvflag").value="1";switchEditors("newVehicle3")}function addUpload(){var i=document.getElementById("fileCount").value;var a="block";if(navigator.appName=="Netscape"){a="table-row"}i++;document.getElementById("row"+i).style.display=a;document.getElementById("fileCount").value=i;if(i>=qtyRemain){document.getElementById("addNote").style.display="none"}}function addPollOption(){var i=document.getElementById("optCount").value;var a="block";if(navigator.appName=="Netscape"){a="table-row"}i++;document.getElementById("row"+i).style.display=a;document.getElementById("optCount").value=i;if(i>=10){document.getElementById("addPollOption").style.display="none"}}function toggleSpec(a){var b=document.getElementById("ct_"+a).value;if(b=="1"){document.getElementById("ct_"+a).value="0";document.getElementById("cti_"+a).src="../images/cross.gif"}else{document.getElementById("ct_"+a).value="1";document.getElementById("cti_"+a).src="../images/tick.gif"}}function checkBlankFields(){var a=true;var b="";for(var i=0;i<checkBlankFields.arguments.length;i++){if(document.getElementById(checkBlankFields.arguments[i]).value==""){a=false;b=b+checkBlankFields.arguments[i]+","}}if(!a){b=b.substr(0,b.length-1);alert("The following fields must be completed: "+b+".")}return a}function checkEventDate(){var a=document.getElementById("startdate_yy").options[document.getElementById("startdate_yy").selectedIndex].value+document.getElementById("startdate_mm").options[document.getElementById("startdate_mm").selectedIndex].value+document.getElementById("startdate_dd").options[document.getElementById("startdate_dd").selectedIndex].value;var b=document.getElementById("enddate_yy").options[document.getElementById("enddate_yy").selectedIndex].value+document.getElementById("enddate_mm").options[document.getElementById("enddate_mm").selectedIndex].value+document.getElementById("enddate_dd").options[document.getElementById("enddate_dd").selectedIndex].value;if(a>b){document.getElementById("enddate_yy").selectedIndex=document.getElementById("startdate_yy").selectedIndex;document.getElementById("enddate_mm").selectedIndex=document.getElementById("startdate_mm").selectedIndex;document.getElementById("enddate_dd").selectedIndex=document.getElementById("startdate_dd").selectedIndex}}function checkSearchAction(a,b){var c=document.getElementById(a).options[document.getElementById(a).selectedIndex].value;if(c=="srchthis"||c=="srchall"){document.getElementById(b).style.display="inline"}else{document.getElementById(b).style.display="none"}}function checkSignup(){var a=true;var b="";var c=document.getElementById("f_username")?document.getElementById("f_username").value:"undefined";var d=document.getElementById("f_pwd")?document.getElementById("f_pwd").value:"undefined";var e=document.getElementById("f_pwd2")?document.getElementById("f_pwd2").value:"undefined";var f=document.getElementById("f_firstname")?document.getElementById("f_firstname").value:"undefined";var g=document.getElementById("f_surname")?document.getElementById("f_surname").value:"undefined";var h=document.getElementById("f_email")?document.getElementById("f_email").value:"undefined";var i=document.getElementById("f_address1")?document.getElementById("f_address1").value:"undefined";var j=document.getElementById("f_postcode")?document.getElementById("f_postcode").value:"undefined";var k=document.getElementById("f_tel")?document.getElementById("f_tel").value:"undefined";var l=document.getElementById("f_mobile")?document.getElementById("f_mobile").value:"undefined";var h=document.getElementById("f_email")?document.getElementById("f_email").value:"undefined";if(c==""){b=b+"You must choose a username.\n"}if((d==""||e=="")){b=b+"You must choose a password.\n"}if((d!=""||e!="")&&(d!=e)){b=b+"Your passwords do not match - please re-type them and try again.\n"}if(f==""){b=b+"You must complete your firstname.\n"}if(g==""){b=b+"You must complete your surname.\n"}if(h==""||!isEmail(h)){b=b+"You must enter a valid email address.\n"}if(i==""){b=b+"You must complete your address.\n"}if(j==""){b=b+"You must complete your postcode.\n"}if(k==""&&l==""){b=b+"You must enter either your telephone or mobile number.\n"}if(b!=""){a=false;alert(b)}return a}function checkProfile(){var a=true;var b="";var c=document.getElementById("f_pwd")?document.getElementById("f_pwd").value:"undefined";var d=document.getElementById("f_pwd2")?document.getElementById("f_pwd2").value:"undefined";var e=document.getElementById("f_firstname")?document.getElementById("f_firstname").value:"undefined";var f=document.getElementById("f_surname")?document.getElementById("f_surname").value:"undefined";var g=document.getElementById("f_email")?document.getElementById("f_email").value:"undefined";var h=document.getElementById("f_address1")?document.getElementById("f_address1").value:"undefined";var i=document.getElementById("f_postcode")?document.getElementById("f_postcode").value:"undefined";var j=document.getElementById("f_tel")?document.getElementById("f_tel").value:"undefined";var k=document.getElementById("f_mobile")?document.getElementById("f_mobile").value:"undefined";var g=document.getElementById("f_email")?document.getElementById("f_email").value:"undefined";var l=document.getElementById("vids")?document.getElementById("vids").value:"";var m=document.getElementById("nvflag")?document.getElementById("nvflag").value:"0";var n="";var o="";var p="";if(m=="1"){if(l.length){l=l+",nv"}else{l=l+"nv"}}l=l.split(",");if((c!=""||d!="")&&(c!=d)){b=b+"Your passwords do not match - please re-type them and try again.\n"}if(e==""){b=b+"You must complete your firstname.\n"}if(f==""){b=b+"You must complete your surname.\n"}if(g==""||!isEmail(g)){b=b+"You must enter a valid email address.\n"}if(h==""){b=b+"You must complete your address.\n"}if(i==""){b=b+"You must complete your postcode.\n"}if(j==""&&k==""){b=b+"You must enter either your telephone or mobile number.\n"}if(l!=""){for(var q=0;q<l.length;q++){n=document.getElementById("make_"+l[q]).options[document.getElementById("make_"+l[q]).selectedIndex].value;o=document.getElementById("bodyline_"+l[q]).options[document.getElementById("bodyline_"+l[q]).selectedIndex].value;p=document.getElementById("model_"+l[q]).options[document.getElementById("model_"+l[q]).selectedIndex].value;if(n==""||o==""||p==""){b=b+"You must specify Make, Model and Trim for each vehicle.\n";break}}}if(b!=""){a=false;alert(b)}else{waitSubmit()}return a}function checkClassifieds(){var a=true;var b="";var c=document.getElementById("f_heading")?document.getElementById("f_heading").value:"undefined";var d=document.getElementById("f_price")?document.getElementById("f_price").value:"undefined";var e=document.getElementById("f_email")?document.getElementById("f_email").value:"undefined";var f=document.getElementById("f_name")?document.getElementById("f_name").value:"undefined";var g=document.getElementById("f_tel")?document.getElementById("f_tel").value:"undefined";if(c==""){b=b+"You must enter a heading to briefly describe your entry.\n"}if(e==""&&g==""){b=b+"You must enter either your email address or telephone number so you can be contacted about your advert.\n"}if(!isNumeric(d)){b=b+"Please only enter numbers (0-9) in the price field, or leave it blank to indicate you will accept offers.\n"}if(b!=""){a=false;alert(b)}else{if(document.getElementById("go")){waitSubmit()}}return a}function checkBooking(){var a=true;var b="";var c=document.getElementById("f_firstname")?document.getElementById("f_firstname").value:"undefined";var d=document.getElementById("f_surname")?document.getElementById("f_surname").value:"undefined";var e=document.getElementById("f_email")?document.getElementById("f_email").value:"undefined";var f=document.getElementById("f_accept")?document.getElementById("f_accept").checked:true;if(c==""||d==""||e==""){b=b+"You must complete all fields before trying to book your place.\n"}if(!f){b=b+"You must indicate your acceptance of the JeepClub Terms and Conditions by ticking the box.\n"}if(b!=""){a=false;alert(b)}return a}function checkDiscussion(){var a=document.getElementById("action").options[document.getElementById("action").selectedIndex].value;var b=false;if(a=="new"){var c=document.getElementById("g").value;rightFrame("topic.cfm?g="+c);b=false}else{b=true}return b}function checkHomeActions(a){var b=document.getElementById(a).options[document.getElementById(a).selectedIndex].value;var c=true;if(b=="modprf"){rightFrame("myprofile.cfm");c=false}else{if(b=="friends"){rightFrame("myfriends.cfm");c=false}else{if(b=="extend"){rightFrame("payment.cfm?p=m");c=false}else{if(b=="terminate"){if(confirm("Are you sure you wish to terminate your membership?\nThis process will remove your personal information and cannot be undone.  Click OK if you are sure you wish to proceed, otherwise click Cancel.")){rightFrame("terminate.cfm")}c=false}}}}return c}function checkNewTopic(){var a=true;var b="";var s=document.getElementById("s")?document.getElementById("s").value:"undefined";if(s==""){b=b+"You must enter a subject to describe this new topic.\n"}if(b!=""){a=false;alert(b)}return a}function subWizardEvent(a){var b=document.getElementById(a).options[document.getElementById(a).selectedIndex].value;if(b!=""){rightFrame("admin.cfm?action=eventedit&vid="+b)}return false}function subWizardWaiver(a){var b=document.getElementById(a).options[document.getElementById(a).selectedIndex].value;if(b!=""){pop("admin/eventwaiver.cfm?id="+b,"640","400","1","1")}return false}function isEmail(a){if(a.search(/^\w+((-\w+)|(\.\w+))*\@[A-Za-z0-9]+((\.|-)[A-Za-z0-9]+)*\.[A-Za-z0-9]+$/)!=-1){return true}else{return false}}function isNumeric(a){var b="0123456789.";var c=true;var d;for(i=0;i<a.length&&c==true;i++){d=a.charAt(i);if(b.indexOf(d)==-1){c=false}}return c}function readToggle(a,b){for(var i=1;i<=b;i++){document.getElementById("r"+i+"_"+a).className=""}}function rightFrame(a){top.right.location=a}function leftFrame(a){top.left.location=a}function waitSubmit(){document.getElementById("go").src="../images/wait.gif"}function prepForPayPal(){document.getElementById("right").style.margin="0";document.getElementById("waitpage").style.display="inline";parent.document.getElementById("mainframeset").cols="0,100%"}function restoreFromPayPal(){parent.document.getElementById("mainframeset").cols="50%,50%";window.name="right"}function signinAlert(a){document.getElementById("signinbubbletext").innerHTML=a;document.getElementById("signinbubblewrap").style.display="inline";window.setTimeout("signinAlertClose()",5000)}function signinAlertClose(){document.getElementById("signinbubblewrap").style.display="none"}function newMailAlert(a){document.getElementById("newmailbubbletext").innerHTML=a;document.getElementById("newmailbubblewrap").style.display="inline";window.setTimeout("newMailAlertClose()",5000)}function newMailAlertClose(){document.getElementById("newmailbubblewrap").style.display="none"}function galleryPop(a,b,c){var d="new_wnd";var e=0;var f=0;var g=0;if(screen){f=(screen.width/2)-(b/2);g=(screen.height/2)-(c/2)}var h=window.open(a,d,"height="+c+",width="+b+",status=0,toolbar=0,resizable="+e+",scrollbars=0,menubar=0,location=0,directories=0,left="+f+",top="+g+"")}function pop(a,b,c,d,e){var f="new_wnd";var g=0;var h=0;if(screen){g=(screen.width/2)-(b/2);h=(screen.height/2)-(c/2)}var i=window.open(a,f,"height="+c+",width="+b+",status=0,toolbar=0,resizable="+d+",scrollbars="+e+",menubar=0,location=0,directories=0,left="+g+",top="+h+"")}function getBodyWidth(){var a=0;if(self.innerHeight){a=self.innerWidth}else{if(document.documentElement&&document.documentElement.clientHeight){a=document.documentElement.clientWidth}else{if(document.body){a=document.body.clientWidth}}}return a}function resizeImages(){var a=document.getElementsByTagName("IMG");var b=getBodyWidth()-50;for(var i=0;i<a.length;i++){if(a[i].width>b){_w=a[i].width;_h=a[i].height;_factor=b/_w;a[i].width=_w*_factor;a[i].height=_h*_factor}}}function convertLinks(){for(var i=0;i<arguments.length;i++){var a=document.getElementById("msg_"+arguments[i]);var b=a.getElementsByTagName("A");for(var j=0;j<b.length;j++){var c=b[j];c.title+="This link will open in a new window";c.target="_blank;"}}}function quoteMsg(a,b){var c=document.getElementById("msg_"+b).innerHTML;var d=FCKeditorAPI.GetInstance("msg");c='<div class="quotefrom">'+a+' said:</div><div class="quote">'+c+"</div>";d.InsertHtml(c)}function preloadImages(){var d=document;if(d.images){if(!d.MM_p){d.MM_p=new Array()}var i,j=d.MM_p.length,a=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 hide(a){document.getElementById(a).style.display="none"}function show(a){document.getElementById(a).style.display="block"}function showReminder(){var a="block";if(navigator.appName=="Netscape"){a="table-row"}document.getElementById("reminder").style.display=a;document.getElementById("reminderh1").style.display="none";document.getElementById("reminderh2").style.display="none";document.getElementById("showReminder").value="1"}function textValueToFirstUpper(a){if(-1==a.value.search(/^[A-Z]/)){a.value=a.value.substr(0,1).toUpperCase()+a.value.substr(1)}}function changeCase(a){inptext=a.value;outtext="";delim=".?!";punc=",.?!:;)' ";caseflag=1;inptext=inptext.toLowerCase();for(i=0;i<inptext.length;i++){chr=inptext.charAt(i);if(caseflag==1){puncflag=0;for(j=0;j<punc.length;j++){if(chr==punc.charAt(j)){puncflag=1;j=punc.length}}if(puncflag==1){outtext=outtext+chr}else{outtext=outtext+chr.toUpperCase();caseflag=0}}else{delimflag=0;for(j=0;j<delim.length;j++){if(chr==delim.charAt(j)){delimflag=1;j=delim.length}}if(delimflag==1){caseflag=1}outtext=outtext+chr}}a.value=outtext}function clearField(a,b){if(a.value==b){a.value=""}}function textValueToFirstUpper(a){if(-1==a.value.search(/^[A-Z]/)){a.value=a.value.substr(0,1).toUpperCase()+a.value.substr(1)}}function loadMap(a,b){if(GBrowserIsCompatible()){var c=new GMap2(document.getElementById("map"));c.addControl(new GSmallMapControl());c.setCenter(new GLatLng(a,b),13);c.addOverlay(new GMarker(new GLatLng(a,b)))}}function showMap(a,b){document.getElementById("map").style.display="block";document.getElementById("mapLink").style.display="none";loadMap(a,b)}function showPoll(){var a="block";if(navigator.appName=="Netscape"){a="table-row"}document.getElementById("pollLink").style.display="none";document.getElementById("pollHeader").style.display=a;document.getElementById("pollSubject").style.display=a;document.getElementById("row1").style.display=a;document.getElementById("row2").style.display=a;document.getElementById("addPollOption").style.display=a;document.getElementById("optCount").value=2;document.getElementById("ps").value=document.getElementById("s").value}function showCap(){document.getElementById("cap1").style.display="block";document.getElementById("cap2").style.display="block"}function hideCap(){document.getElementById("cap1").style.display="none";document.getElementById("cap2").style.display="none"}function nextImg(){if(curImg<(imgs.length-1)){curImg++;showCap();showImg(curImg)}}function prevImg(){if(curImg>0){curImg--;showCap();showImg(curImg)}}function showImg(i){document.getElementById("img").src=imgs[i];document.getElementById("cap1").innerHTML=caps[i];document.getElementById("cap2").innerHTML=caps[i]}function searchSelectBox(a,b){sSearchString=document.getElementById(a).value.toUpperCase();iSearchTextLength=sSearchString.length;if(iSearchTextLength>0){for(j=0;j<document.getElementById(b).options.length;j++){sOptionText=document.getElementById(b).options[j].text;sOptionComp=sOptionText.substr(0,iSearchTextLength).toUpperCase();if(sSearchString==sOptionComp){document.getElementById(b).selectedIndex=j;break}else{document.getElementById(b).selectedIndex=-1}}}else{document.getElementById(b).selectedIndex=-1}}function scrollBottom(){var a=window.opera?true:false;if(document.layers){var b=window.document.height}else{if(a){var b=1000}else{if(document.all){var b=document.body.scrollHeight}else{if(document.getElementById){var b=window.document.height}}}}window.scrollTo(0,b)}function FCKeditor_OnComplete(a){FCKeditorLoaded=true}function switchEditors(a){if(!FCKeditorLoaded){setTimeout("switchEditors('"+a+"')",500);return}DoSwitchEditors(document.getElementById(a))}function DoSwitchEditors(a){var i;for(i=0;i<a.childNodes.length;i++){childNode=a.childNodes.item(i);editor=FCKeditorAPI.GetInstance(childNode.name);if(editor&&editor.EditorDocument&&editor.EditMode==FCK_EDITMODE_WYSIWYG){editor.SwitchEditMode();editor.SwitchEditMode()}DoSwitchEditors(childNode)}}