thou_separator=','; deci_point='.'; function sbcurrency_display_format(amount) { amount=amount.toString().replace(/\./,deci_point); return(amount); } function sbcurrency_calculation_format(value) { var pattern_sp=/,/g; var pattern_pt=/\./g; value=value.toString().replace(pattern_sp,""); //remove thousand separator if any value=value.toString().replace(pattern_pt,"."); //restore decimal point return value; } function convert_2_seo(title,seo) { //a=title.value.replace(/^[^a-zA-Z]+/,""); //a=a.replace(/[^a-zA-Z0-9_\-]+/g,"_"); //a=a.replace(/[^a-zA-Z]+$/,""); a=title.value.replace(/[\.\/\?& ]+/g,"_"); seo.value=a.toLowerCase(); } function validate_seo_url(seo_url,skip_test) { var error_msg = new Array(); if(skip_test) { error_msg[0]= "Please specify some value for Optimized URL Text"; error_msg[1]= "Optimized URL Text must not contain \.\/\?& characters"; } else{ error_msg[0]= "Please specify some value for Optimized URL Text"; error_msg[1]= "Optimized URL Text must not contain \.\/\?& characters"; } if(skip_test!=1 && seo_url=="") return(error_msg[0]); else { if(seo_url!="") { if(seo_url.match(/[\.\/\?& ]/)) return(error_msg[1]); } } return; } function validate_seo_title(str,skip_test) { var error_msg = new Array(); if(skip_test) { error_msg[0]= "Please specify some value for Page Title"; } else { error_msg[0]= "Please specify some value for Page Title"; } if(skip_test!=1 && str=="") return(error_msg[0]); return; } function validate_seo_keyword(str,skip_test) { var error_msg = new Array(); if(skip_test) { error_msg[0]= "Please specify some value for Meta Keywords"; } else { error_msg[0]= "Please specify some value for Meta Keywords"; } if(skip_test!=1 && str=="") return(error_msg[0]); return; } function validate_seo_desc(str,skip_test) { var error_msg = new Array(); if(skip_test) { error_msg[0]= "Please specify some value for Meta Description"; } else { error_msg[0]= "Please specify some value for Meta Description"; } if(skip_test!=1 && str=="") return(error_msg[0]); return; } function validate_subscribe(frm) //-------- used in FE only { if ( frm.sbfirst_name.value == "" ) { alert("Please specify First Name"); frm.sbfirst_name.focus(); return false; } if(frm.sbfirst_name.value.match(/[&<>]+/)) { alert("Please remove invalid characters from First Name (e.g. & < >)"); frm.sbfirst_name.focus(); return(false); } if(!frm.sbemail.value.match(/[a-zA-Z\.\@\d\_]/)) { alert("Invalid email address"); frm.sbemail.focus(); return false; } if (!emailCheck (frm.sbemail.value,false) ) { frm.sbemail.focus(); return (false); } if(frm.sbemail.value.match(/[&<>]+/)) { alert("Please remove invalid characters from Email (e.g. & < >)"); frm.sbemail.focus(); return(false); } } function validate_poll(frm) { var checked='no'; for (var i=0;i < frm.elements.length;i++) { var e =frm.elements[i]; if (e.checked==true && e.type=="radio") sbpoll=e.value; } return sbopenpopup('poll_results.php?sbtiny=1&sb_id='+frm.sb_id.value+'&sbpoll='+sbpoll,400,350); } function emailCheck (emailStr,is_admin) { var error_msg = new Array(); if(is_admin) { error_msg[0]= "Email address seems incorrect (check @ and .'s)"; error_msg[1]= "The username doesn't seem to be valid"; error_msg[2]= "Destination IP address is invalid"; error_msg[3]= "The domain name doesn't seem to be valid"; error_msg[4]= "The address must end in a valid domain, or two letter country"; error_msg[5]= "This address is missing a hostname"; } else { error_msg[0]="Email address seems incorrect (check @ and .\'s)"; error_msg[1]= "The username doesn\'t seem to be valid"; error_msg[2]= "Destination IP address is invalid"; error_msg[3]= "The domain name doesn\'t seem to be valid"; error_msg[4]= "The address must end in a valid domain, or two letter country"; error_msg[5]= "This address is missing a hostname"; } var emailPat=/^(.+)@(.+)$/ var specialChars="\\(\\)<>@,;:\\\\\\\"\\.\\[\\]" var validChars="\[^\\s" + specialChars + "\]" var quotedUser="(\"[^\"]*\")" var ipDomainPat=/^\[(\d{1,3})\.(\d{1,3})\.(\d{1,3})\.(\d{1,3})\]$/ var atom=validChars + '+' var word="(" + atom + "|" + quotedUser + ")" var userPat=new RegExp("^" + word + "(\\." + word + ")*$") var domainPat=new RegExp("^" + atom + "(\\." + atom +")*$") var matchArray=emailStr.match(emailPat) if (matchArray==null) { alert(error_msg[0]) return false } var user=matchArray[1] var domain=matchArray[2] if (user.match(userPat)==null) { alert(error_msg[1]) return false } var IPArray=domain.match(ipDomainPat) if (IPArray!=null) { // this is an IP address for (var i=1;i<=4;i++) { if (IPArray[i]>255) { alert(error_msg[2]) return false } } return true } var domainArray=domain.match(domainPat) if (domainArray==null) { alert(error_msg[3]) return false } var atomPat=new RegExp(atom,"g") var domArr=domain.match(atomPat) var len=domArr.length if (domArr[domArr.length-1].length < 2 || domArr[domArr.length-1].length > 4) { alert(error_msg[4]) return false } if (len < 2) { var errStr= error_msg[5]; alert(errStr) return false } return true; } function sbis_empty(sbstr) { sbnew_str=sbstr.replace(/^\s+|\s+$/g,""); if(sbnew_str.length>0) return (false); else return (true); } /////////////menubar function menucnt=0; diplayed_menu = new Array(); function initdropmenu() { document.onclick=hidemenu; document.getElementById("menudrop1").onclick=showmenu; document.getElementById("menudrop1").onmouseover=showmenu; document.getElementById("menudrop1").onmouseout=hidemenu; if(document.getElementById("menudrop2") != null) { document.getElementById("menudrop2").onclick=showmenu; document.getElementById("menudrop2").onmouseover=showmenu; document.getElementById("menudrop2").onmouseout=hidemenu; } } function showmenu(e) { diplayed_menu[menucnt]=this.firstChild.nextSibling; this.firstChild.style.textDecoration='none'; diplayed_menu[menucnt].style.visibility='visible'; menucnt++; } function hidemenu() { for(i=0;i < diplayed_menu.length;i++) diplayed_menu[i].style.visibility='hidden'; }