function msgconfirm(msgSTR,toURL){ if(confirm(msgSTR)==true){ document.location=toURL;}
}
function directURL(toURL){ document.location="index.html?act="+toURL;}
function confirmDelete(){ if(confirm('Are you sure to delete?')==1){ return true;}
return false;}
function go(url, tool, menu, loc, scroll, resize, status, left, top, width, height) { OpenWin = this.open(url, "CtrlWindow", "toolbar=" + tool + ",menubar=" + menu + ",location=" + loc + ",scrollbars=" + scroll + ",resizable=" + resize + ",status=" + status + ",left=" + left + ",top=" + top + ",width=" + width + ",height=" + height);}
var popUpWin=0; function popUpWindow(URLStr, left, top, width, height)
{ if(popUpWin)
{ if(!popUpWin.closed) popUpWin.close();}
popUpWin = open(URLStr, 'popUpWin', 'toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=no,resizable=no,copyhistory=yes,width='+width+',height='+height+',left='+left+', top='+top+',screenX='+left+',screenY='+top+'');}
function openPopUp(url, windowName, w, h, scrollbar) { var winl = (screen.width - w) / 2; var wint = (screen.height - h) / 2; winprops = 'height='+h+',width='+w+',top='+wint+',left='+winl+',scrollbars='+scrollbar ; win = window.open(url, windowName, winprops); if (parseInt(navigator.appVersion) >= 4) { win.window.focus();}
}
function popup(path,x,y)
{ pop=window.open(path,'control','directories=0,location=0,menubar=0,resizable=0,scrollbars=0,status=0,toolbar=0,locationbar=0,width='+x+',height='+y+',innerwidth='+x+',innerheight='+y); pop.focus();}
function popUp(URL)
{ day = new Date(); id = day.getTime(); eval("page" + id + " = window.open(URL, '" + id + "', 'toolbar=0,scrollbars=1,location=0,statusbar=0,menubar=0,resizable=1,width=600,height=300,left = 362,top = 234');");}
function newWindow(page, width, height){ OpenWin = this.open(page, "_blank", "toolbar=no,menubar=no,location=no,directories=no,status=no,scrollbars=yes,resizable=yes,ScreenX=0,ScreenY=0,top=0,left=0,width=" + width+ ",height=" + height);}
function sampleWindow(page, myWidth, myHeight){ var pos_x = (this.screen.width - myWidth) / 2; var pos_y = (this.screen.height - myHeight) / 2; OpenWin = this.open(page, "_blank", "toolbar=no,menubar=no,location=no,directories=no,status=no,scrollbars=no,resizable=no,ScreenX=0,ScreenY=0,top=" + pos_y + ",left=" + pos_x + ",width=" + myWidth+ ",height=" + myHeight);}
function OpenWindow(page, width, height){ OpenWin = this.open(page, "_blank", "toolbar=yes,menubar=yes,location=yes,directories=yes,status=yes,scrollbars=yes,resizable=yes,ScreenX=0,ScreenY=0,top=0,left=0,width=" + width+ ",height=" + height);}
function ltrim(str)
{ var whitespace = new String(" \t\n\r"); var s = new String(str); if (whitespace.indexOf(s.charAt(0)) != -1) { var j=0, i = s.length; while (j < i && whitespace.indexOf(s.charAt(j)) != -1)
j++; s = s.substring(j, i);}
return s;}
function rtrim(str)
{ var whitespace = new String(" \t\n\r"); var s = new String(str); if (whitespace.indexOf(s.charAt(s.length-1)) != -1) { var i = s.length - 1; while (i >= 0 && whitespace.indexOf(s.charAt(i)) != -1)
i--; s = s.substring(0, i+1);}
return s;}
function cNum(e) { var strCheck = '0123456789'; var whichCode = (window.Event) ? e.which : e.keyCode; key = String.fromCharCode(whichCode); if (strCheck.indexOf(key) == -1) return false;}
function trim(str) { return rtrim(ltrim(str));}
function Trim2(str)
{ return str.replace(/^\s*(.*?)[\s\n]*$/g, '$1');}
function Chop(str)
{ return str.replace(/\n*$/, '').replace(/^\n*/, '');}
function Unindent(str)
{ var lines = str.split('\n'); var indents = new Array(); var regex = new RegExp('^\\s*', 'g'); var min = 1000; for(var i = 0; i < lines.length && min > 0; i++)
{ if(Trim(lines[i]).length == 0)
continue; var matches = regex.exec(lines[i]); if(matches != null && matches.length > 0)
min = Math.min(matches[0].length, min);}
if(min > 0)
for(var i = 0; i < lines.length; i++)
lines[i] = lines[i].substr(min); return lines.join('\n');}
function IsOptionSet(value, list)
{ for(var i = 0; i < list.length; i++)
if(list[i] == value)
return true; return false;}
function push(array, value)
{ array[array.length] = value;}
function readCookie(name)
{ var cookieValue = ""; var search = name + "="; if(document.cookie.length > 0)
{ offset = document.cookie.indexOf(search); if (offset != -1)
{ offset += search.length; end = document.cookie.indexOf(";", offset); if (end == -1) end = document.cookie.length; cookieValue = unescape(document.cookie.substring(offset, end))
}
}
return cookieValue;}
function createCookie(name,value,days) {
if (days) {
var date = new Date();
date.setTime(date.getTime()+(days*24*60*60*1000));
var expires = "; expires="+date.toGMTString();
}
else var expires = "";
document.cookie = name+"="+value+expires+"; path=/";
}
function writeCookie(name, value, hours)
{ var expire = ""; if(hours != null)
{ expire = new Date((new Date()).getTime() + hours * 3600000); expire = "; expires=" + expire.toGMTString();}
document.cookie = name + "=" + escape(value) + expire;}
function getCookie(name) { var sPos = document.cookie.indexOf(name + "="); var len = sPos + name.length + 1; if((!sPos) && (name != document.cookie.substring(0, name.length))){ return null;}
if(sPos == -1){ return null;}
var ePos = document.cookie.indexOf(';', len); if(ePos == -1) ePos = document.cookie.length; return unescape(document.cookie.substring(len, ePos));}
function setCookie(name, value, expires, path, domain, secure){ var today = new Date(); if(expires){ expires = expires * 1000 * 3600 * 24;}
document.cookie = name+'='+escape(value) + ((expires) ? ';expires=' + new Date(today.getTime() + expires).toGMTString() : '') + ((path) ? ';path=' + path : '') + ((domain) ? ';domain=' + domain : '') + ((secure) ? ';secure' : '');}
function deleteCookie(name, path, domain){ if(getCookie(name)){ setCookie(name, '', -30, path, domain);}
}
function BrowserInfo()
{ this.name = navigator.appName; this.codename = navigator.appCodeName; this.version = navigator.appVersion.substring(0,4); this.platform = navigator.platform; this.javaEnabled = navigator.javaEnabled(); this.screenWidth = screen.width; this.screenHeight = screen.height;}
function platformDetect()
{ if(navigator.appVersion.indexOf("Win") != -1)
{ alert("Windows");}
else if(navigator.appVersion.indexOf("Mac") != -1)
{ alert("Macintosh");}
else alert("Other");}
function CheckUncheckAll(the_form)
{ for (var i=0; i < the_form.elements.length; i++)
{ if (the_form.elements[i].type=="checkbox")
{ the_form.elements[i].checked = !(the_form.elements[i].checked);}
}
}
function CheckcheckAll(the_form)
{ for (var i=0; i < the_form.elements.length; i++)
{ if (the_form.elements[i].type=="checkbox")
{ the_form.elements[i].checked = the_form.elements[i].checked;}
}
}
function invert_selection(form) { for (var c = 0; c < form.elements.length; c++) { if (form.elements[c].type == 'checkbox') { if(form.elements[c].checked == true) { form.elements[c].checked = false;} else { form.elements[c].checked = true;}
}
}
}
function ConfirmURL(inputText, inputURL)
{ if (confirm(inputText)) document.location=inputURL;}
function expand()
{ var Nodes = document.getElementsByTagName("table"); var max = Nodes.length; for(var i = 0;i < max;i++) { var nodeObj = Nodes.item(i); var str = nodeObj.id; if (str.match("section")) { nodeObj.style.display = 'block';}
}
}
function hideall()
{ var Nodes = document.getElementsByTagName("table"); var max = Nodes.length; for(var i = 0;i < max;i++) { var nodeObj = Nodes.item(i); var str = nodeObj.id; if (str.match("section")) { nodeObj.style.display = 'none';}
}
}
function updatePasswordStrength()
{ var password = document.Addadm.password1.value; var strength = 0; locase_matches = password.match(/[a-z_]/g); digit_matches = password.match(/[0-9]/g); upcase_matches = password.match(/[A-Z]/g); special_matches = password.match(/\W/g); if (password.length>5) { strength += password.length - 5; if (locase_matches && upcase_matches)
strength += upcase_matches.length; if (locase_matches && digit_matches)
strength += digit_matches.length; if (special_matches)
strength += special_matches.length; if ((locase_matches || upcase_matches) && special_matches && digit_matches)
strength += 2;}
for (var i=0; i < easy_guesses.length; ++i) { if (easy_guesses[i].length>3 && (password.indexOf(easy_guesses[i])!=-1)) { strength=0; break;}
}
var pstrength_elem = document.getElementById('password_strength'); var pstrength_text = document.getElementById('password_strength_text'); if (password.length==0) { pstrength_elem.className = 'password_empty'; pstrength_text.innerHTML = 'None';}
else if (strength<3) { pstrength_elem.className = 'password_weak'; pstrength_text.innerHTML = 'Weak';}
else if (strength<7) { pstrength_elem.className = 'password_fair'; pstrength_text.innerHTML = 'Fair';}
else if (strength<10) { pstrength_elem.className = 'password_good'; pstrength_text.innerHTML = 'Good';}
else { pstrength_elem.className = 'password_strong'; pstrength_text.innerHTML = 'Strong';}
}
var from_time = new Date(); from_time = from_time.getTime(); function show_loading_time()
{ var to_time = new Date(); to_time = to_time.getTime(); var secs = (to_time - from_time) /1000; var pageload = secs + " seconds"; document.write(pageload);}
function datediff(intDay1,intMonth1,intYear1,intDay2,intMonth2,intYear2) { var in_days = 0; v1 = Date.UTC(intYear1,intMonth1,intDay1); v2 = Date.UTC(intYear2,intMonth2,intDay2); in_days = Math.abs(parseInt(v1)-parseInt(v2))/86400000; return in_days;}
function IsEmpty(val){ return (val=="");}
function IsNothing(val){ return (Trim(val)=="");}
function ScrollSelect(sel){ if (sel.selectedIndex>0){ sel.selectedIndex--; sel.selectedIndex++;}
}
function GoBack(){ window.history.back(); return false;}
function resetfilena(){ document.forms[0].filena.value=''; document.forms[0].filena.focus();}
function OneWord(string){ var length,i=0,space=false; var trimmed = Trim(string); length = trimmed.length; while(!space && (i<length)){ if (trimmed.substr(i,1)==" ")
space=true; else
i++;}
return !space;}
function TextsRbutton(array_txt,btn){ var empty = true; var i = 0; while(empty && i<array_txt.length){ empty = IsEmpty(array_txt[i].value); i++;}
btn.disabled = empty;}
function TextSbutton(txt,btn){ btn.disabled = IsNothing(txt.value);}
function SelectButton(sel,btn){ btn.disabled = (sel.selectedIndex<0);}
function Select0Button(sel,btn){ btn.disabled = (sel.selectedIndex<1);}
function FormResetSubmitText(frm,btn_reset,btn_submit,txt){ frm.reset(); btn_reset.disabled = true; btn_submit.disabled = true; txt.focus();}
function CheckedDisabled(roc,ele){ ele.disabled = !roc.checked;}
function getNNVersionNumber() { if (navigator.appName == "Netscape") { var appVer = parseFloat(navigator.appVersion); if (appVer < 5) { return appVer;} else { if (typeof navigator.vendorSub != "undefined")
return parseFloat(navigator.vendorSub);}
}
return 0;}
function blocking(nr, type) { var browser = navigator.appName; if (browser == "Microsoft Internet Explorer") { type = 'block';}
if (document.layers) { current = (document.layers[nr].display == 'none') ? type : 'none'; document.layers[nr].display = current;} else if (document.all) { current = (document.all[nr].style.display == 'none') ? type : 'none'; document.all[nr].style.display = current;} else if (document.getElementById) { vista = (document.getElementById(nr).style.display == 'none') ? type : 'none'; document.getElementById(nr).style.display = vista;}
}
function MM_setTextOfLayer(objName,x,newText) { if ((obj=findObj(objName))!=null) with (obj)
if (document.layers) {document.write(unescape(newText)); document.close();}
else innerHTML = unescape(newText);}
function findObj(n, d) { var p,i,x; if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) { d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n]; for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=findObj(n,d.layers[i].document); if(!x && d.getElementById) x=d.getElementById(n); return x;}
function MM_showHideLayers() { var i,p,v,obj,args=MM_showHideLayers.arguments; for (i=0; i<(args.length-2); i+=3) if ((obj=findObj(args[i]))!=null) { v=args[i+2]; if (obj.style) { obj=obj.style; v=(v=='show')?'visible':(v=='hide')?'hidden':v;}
obj.visibility=v;}
}
function decision(message, url){ if(confirm(message)) location.href = url;}
function addImage(fileName, sActiveImage){ if (fileName != null){ targetfield = 'imageName'; targetdiv = 'selectedImage';} else { targetfield = 'imageName'; targetdiv = 'selectedImage';}
imagefield = findObj(targetfield); if (sActiveImage != ''){ imagehtml = '<img src="'+sActiveImage+'" alt="'+fileName+'"><p><input type="button" class="submit" src="../images/remove.gif" name="remove" style="width: 220px;" value="Remove / Change Image" onclick="addImage(\'\',\'\')" /></p>'; imagefield.value = fileName; MM_setTextOfLayer(targetdiv,'',imagehtml); MM_showHideLayers('imageControls','','hide');} else { imagefield.value = ""; MM_setTextOfLayer(targetdiv,'',''); MM_showHideLayers('imageControls','','show');}
}
function MM_reloadPage(init) { if (init==true) with (navigator) {if ((appName=="Netscape")&&(parseInt(appVersion)==4)) { document.MM_pgW=innerWidth; document.MM_pgH=innerHeight; onresize=MM_reloadPage;}}
else if (innerWidth!=document.MM_pgW || innerHeight!=document.MM_pgH) location.reload();}
MM_reloadPage(true); function MM_showHideLayers() { var i,p,v,obj,args=MM_showHideLayers.arguments; for (i=0; i<(args.length-2); i+=3) if ((obj=findObj(args[i]))!=null) { v=args[i+2]; if (obj.style) { obj=obj.style; v=(v=='show')?'visible':(v=='hide')?'hidden':v;}
obj.visibility=v;}
}
function MM_goToURL() { var i, args=MM_goToURL.arguments; document.MM_returnValue = false; for (i=0; i<(args.length-1); i+=2) eval(args[i]+".location='"+args[i+1]+"'");}
function MM_displayStatusMsg(msgStr) { status=msgStr; document.MM_returnValue = true;}
function preloadImagesBoxes() { var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array(); var i,j=d.MM_p.length,a=preloadImagesBoxes.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 jumpMenu(target,object,restore){ eval(target+".location='"+object.options[object.selectedIndex].value+"'"); if (restore) object.selectedIndex=0;}
function findObj(n, d) { var p,i,x; if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) { d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n]; for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=findObj(n,d.layers[i].document); if(!x && d.getElementById) x=d.getElementById(n); return x;}
function togglerowhighlight(obj, boxid) { if (document.getElementById(boxid).checked) { obj.className = 'selected';} else { obj.className = '';}
}
function CheckAll() { for (var i=0;i<document.form.elements.length;i++) { var e = document.form.elements[i]; if ((e.name == 'id[]') && (e.type=='checkbox')) { e.checked = document.form.selectall.checked; togglerowhighlight(document.getElementById("r" + e.id), e.id);}
}
}
function fileName(data)
{ name=isNaN(data)? data:fileList[data][0]; if(name.indexOf('/')!=-1)
{ name=name.substr(name.lastIndexOf('/')+1);}
if(name.indexOf('^')!=-1)
{ name=name.substr(0, name.indexOf('^'));}
return name;}
function include(scriptFilename) { document.write('<' + 'script'); document.write(' language="javascript"'); document.write(' type="text/javascript"'); document.write(' src="' + scriptFilename + '">'); document.write('</' + 'script' + '>');}
var css; function include_css(css_file) { var html_doc = document.getElementsByTagName('head')[0]; css = document.createElement('link'); css.setAttribute('rel', 'stylesheet'); css.setAttribute('type', 'text/css'); css.setAttribute('href', css_file); html_doc.appendChild(css); css.onreadystatechange = function () { if (css.readyState == 'complete') { alert('CSS onreadystatechange fired');}
}
css.onload = function () { alert('CSS onload fired');}
return false;}
var js; function include_js(file) { var html_doc = document.getElementsByTagName('head')[0]; js = document.createElement('script'); js.setAttribute('type', 'text/javascript'); js.setAttribute('src', file); html_doc.appendChild(js); js.onreadystatechange = function () { if (js.readyState == 'complete') { alert('JS onreadystate fired');}
}
js.onload = function () { alert('JS onload fired');}
return false;}
function addLoadEvent(func) { var oldonload = window.onload; if (typeof window.onload != 'function') { window.onload = func;} else { window.onload = function() { oldonload(); func();}
}
}

function changeFormAction() {

  var searchField = document.getElementById("searchfield").value;
  searchField = searchField.replace(/(--)|(\/)|(,)|(\\)|(\')|(\")|(:)|(;)|(\?)|(=)|(\+)|(!)|(&)|(>)|(<)|(\*)|(\))|(\()|([)|(])|(\^)|(\%)|(\|)|(#)|(@)|(`)|(~)|(\$)/ig,"");

  var searchForm=document.getElementById("search_form");
  searchForm.action= searchForm.action + searchField;
  searchForm.submit();
  
}
