function openNewWindow(s_url){var bookWindow=window.open(s_url,'popWin','width=500,height=300,scrollbars=yes,menubar=no,left=300,top=0');bookWindow.focus();}
function jsNewWindow(win_url,win_name){if(!win_name){win_name='popWindow';}
var newWin=window.open(win_url,win_name,'width=500,height=300,scrollbars=yes,menubar=no,left=300,top=0');newWin.focus();}
function confirmAction(s_del_url,s_message){var s_answer=confirm("Are you sure you want to "+s_message);if(s_answer){document.location=s_del_url;}}
function getEventTarget(evt){if(!evt){evt=window.event;}
return evt.target?evt.target:window.event.srcElement;}
function addLoadEvent(fn){if(document.addEventListener){document.addEventListener("DOMContentLoaded",fn,false);}else if(document.attachEvent){window.attachEvent("onload",fn);}}
function addEvent(elm,evType,fn,useCapture){if(elm.addEventListener){elm.addEventListener(evType,fn,useCapture);return true;}
else if(elm.attachEvent){var r=elm.attachEvent('on'+evType,fn);return r;}
else{elm['on'+evType]=fn;}}
function findPos(obj){var curleft=0;var curtop=0;if(obj.offsetParent){do{curleft+=obj.offsetLeft;curtop+=obj.offsetTop;}
while(obj=obj.offsetParent);return[curleft,curtop];}}
function findParent(ref,tag_name){var ref_obj=ref;while(ref.tagName!='BODY'){if(ref_obj.tagName!=tag_name){ref_obj=ref_obj.parentNode;}else{return ref_obj;}}}
function findParentSearch(ref,a_tags){var ref_obj=ref;var len_tags=a_tags.length;while(ref.tagName!='BODY'){var tmp=ref_obj.tagName;for(var i=0;i<len_tags;i++){if(tmp==a_tags[i]){return ref_obj;}}
ref_obj=ref_obj.parentNode;}}
String.prototype.toProperCase=function()
{return this.toLowerCase().replace(/^(.)|\s(.)/g,function($1){return $1.toUpperCase();});}
function createElementName(name,tag_type){var element=null;try{element=document.createElement('<'+tag_type+' name="'+name+'">');}catch(e){element=document.createElement(tag_type);element.name=name;}
return element;}
function createInput(name,type){var element=null;try{element=document.createElement("<input type=\""+type+"\" name=\""+name+"\">");}catch(e){element=document.createElement('input');element.setAttribute('name',name);element.setAttribute('type',type);}
return element;}
function removeAllChildNodes(node){if(node&&node.hasChildNodes&&node.removeChild){while(node.hasChildNodes()){node.removeChild(node.firstChild);}}}
function cancelEvent(e){if(e.preventDefault){e.preventDefault();}else{e.returnValue=false;}
e.cancelBubble=true;if(e.stopPropagation){e.stopPropagation();}}
function getPageSize(){var xScroll,yScroll;if(window.innerHeight&&window.scrollMaxY){xScroll=window.innerWidth+window.scrollMaxX;yScroll=window.innerHeight+window.scrollMaxY;}else if(document.body.scrollHeight>document.body.offsetHeight){xScroll=document.body.scrollWidth;yScroll=document.body.scrollHeight;}else{xScroll=document.body.offsetWidth;yScroll=document.body.offsetHeight;}
var windowWidth,windowHeight;if(self.innerHeight){if(document.documentElement.clientWidth){windowWidth=document.documentElement.clientWidth;}else{windowWidth=self.innerWidth;}
windowHeight=self.innerHeight;}else if(document.documentElement&&document.documentElement.clientHeight){windowWidth=document.documentElement.clientWidth;windowHeight=document.documentElement.clientHeight;}else if(document.body){windowWidth=document.body.clientWidth;windowHeight=document.body.clientHeight;}
if(yScroll<windowHeight){pageHeight=windowHeight;}else{pageHeight=yScroll;}
if(xScroll<windowWidth){pageWidth=windowWidth;}else{pageWidth=xScroll;}
return[pageWidth,pageHeight];}
function getNextElementSibling(targ)
{if(targ){if(targ.nextElementSibling){return targ.nextElementSibling;}else{while(targ.nextSibling&&targ.nextSibling.nodeType!==1){targ=targ.nextSibling;}
return targ.nextSibling;}}}
function getPreviousElementSibling(targ)
{if(targ){if(targ.previousElementSibling){return targ.previousElementSibling;}else{while(targ.previousSibling&&targ.previousSibling.nodeType!==1){targ=targ.previousSibling;}
return targ.previousSibling;}}}
function clearFormControls(ref)
{if(!ref){return false;}
var controls=ref.getElementsByTagName('SELECT'),i=controls.length,tmp;while(i--){controls[i].selectedIndex=0;}
controls=ref.getElementsByTagName('TEXTAREA');i=controls.length;while(i--){controls[i].value='';}
controls=ref.getElementsByTagName('INPUT');i=controls.length;while(i--){tmp=controls[i];switch(tmp.type){case"text":case"hidden":tmp.value='';break;case"checkbox":tmp.checked=false;tmp.value=parseInt(tmp.id.match(/\d+$/),10)+1;break;case"radio":break;}}
tmp=null;controls=null;return ref;}
function createXMLHttpRequest(){var tmp;if(window.XMLHttpRequest){tmp=new XMLHttpRequest();}else{if(window.ActiveXObject){try{tmp=new ActiveXObject("Microsoft.XMLHTTP");}
catch(e){}}}
return tmp;}
function makeGetURL(frm){if(frm.tagName!='FORM'){return"?nc="+new Date().getTime();}
currentForm=frm;var frm_elements=frm.elements.length;var curr_element;var getstr='?';for(i=0;i<frm_elements;i++){curr_element=frm.elements[i];switch(curr_element.tagName)
{case"INPUT":switch(curr_element.type){case"text":case"hidden":getstr+=curr_element.name+"="+escape(curr_element.value)+"&";break;case"checkbox":if(curr_element.checked){getstr+=curr_element.name+"="+escape(curr_element.value)+"&";}
break;case"radio":if(curr_element.checked){getstr+=curr_element.name+"="+escape(frm.curr_element.value)+"&";}
break;}
break;case"SELECT":getstr+=curr_element.name+"="+escape(curr_element.options[curr_element.selectedIndex].value)+"&";break;case"TEXTAREA":var cleanVal=curr_element.value;curr_element.value=cleanVal.replace(/\s+/g,' ');getstr+=curr_element.name+"="+escape(curr_element.value)+"&";break;}}
getstr+="nc="+new Date().getTime();return getstr;}
function makeRequest(frm,ajax_url,ajax_function){if(!ajax_url){ajax_url=frm.action;}
url=ajax_url+makeGetURL(frm);if(window.XMLHttpRequest){xhr=new XMLHttpRequest();}
else{if(window.ActiveXObject){try{xhr=new ActiveXObject("Microsoft.XMLHTTP");}
catch(e){}}}
if(xhr){xhr.onreadystatechange=ajax_function;xhr.open("GET",url,true);xhr.send(null);}
else{alert("Sorry, but I couldn't create an XMLHttpRequest");}
return false;}
function formatTextNode(tmp){return(tmp)?tmp.nodeValue:'';}