
function makeHttpRequest(link,callback_function,return_xml,parameters,updateField,adminPath){var http_request=false;if(window.XMLHttpRequest){http_request=new XMLHttpRequest();}else if(window.ActiveXObject){try{http_request=new ActiveXObject("Msxml2.XMLHTTP");}catch(e){try{http_request=new ActiveXObject("Microsoft.XMLHTTP");}catch(e){}}}
if(!http_request){alert('Unfortunately your browser doesn\'t support this feature.');return false;}
http_request.onreadystatechange=function(){if(http_request.readyState==4){if(http_request.status==200){if(typeof updateField=="undefined"||updateField==''){if(return_xml)
eval(callback_function+'(http_request.responseXML,adminPath)');else eval(callback_function+'(http_request.responseText,adminPath)');}else if(typeof callback_function!="undefined"){toField=document.getElementById(updateField);if(!toField)
alert("can't find"+updateField);else{if(return_xml)
toField.innerHTML=http_request.responseXML;else{var inData=http_request.responseText;toField.innerHTML=inData;}}}else alert('callback function ['+callback_function+'] not found,updateField ['+updateField+'] not found');}else alert('There was a problem with the request.(Code: '+http_request.status+')(debug: '+parameters+')');}}
http_request.open('POST',link,true);http_request.setRequestHeader("Content-type","application/x-www-form-urlencoded");http_request.setRequestHeader("Content-length",parameters.length);http_request.setRequestHeader("Connection","close");http_request.send(parameters);}
function getValues(obj,link,callback,return_xml,updateField){poststr=checkObj(obj);makeHttpRequest(link,callback,return_xml,poststr,updateField,'');}
function getValues2(obj,link,callback,return_xml,updateField,adminPath){poststr=checkObj(obj);makeHttpRequest(link,callback,return_xml,poststr,updateField,adminPath);}
function checkObj(obj){var poststr='';var j=0;poststr+=checkSingleObj(obj);for(j=0;j<obj.childNodes.length;j++)
poststr+=checkObj(obj.childNodes[j]);return poststr;}
function checkSingleObj(obj){var poststr='';if(obj.tagName=="INPUT"){if(obj.type=="text")
poststr+=obj.name+"="+escape(obj.value)+"&";else if(obj.type=="checkbox"){if(obj.checked)
poststr+=obj.name+"="+escape(obj.value)+"&";else poststr+=obj.name+"=&";}else if(obj.type=="radio"){if(obj.checked)
poststr+=obj.name+"="+escape(obj.value)+"&";}else if(!obj.disabled)
poststr+=obj.name+"="+escape(obj.value)+"&";}else if(obj.tagName=="SELECT"){var sel=obj;poststr+=sel.name+"="+escape(sel.options[sel.selectedIndex].value)+"&";}else if(obj.tagName=="Button")
poststr+=obj.name+"="+escape(obj.value)+"&";else if(obj.type=="textarea")
poststr+=obj.name+"="+escape(obj.value)+"&";else if(obj.disabled)
obj.disabled=false;return poststr;}
function adminEdit(text,adminPath){document.getElementById('adminEditField').innerHTML=text;var settings=new WYSIWYG.Settings();settings.ImagesDir=adminPath+"images/";settings.PopupsDir=adminPath+"popups/";settings.CSSFile=adminPath+"styles/wysiwyg.css";settings.ImagePopupFile=adminPath+"popups/insert_image.php";settings.ImagePopupWidth=600;settings.ImagePopupHeight=245;settings.DocPopupFile=adminPath+"popups/insert_file.php";settings.DocPopupWidth=600;settings.DocPopupHeight=245;settings.Width="100%";settings.Height="400px";WYSIWYG.setSettings('PageContent',settings);WYSIWYG._generate('PageContent');}
function adminEdit2(text,adminPath){document.getElementById('adminEditField2').innerHTML=text;var settings=new WYSIWYG.Settings();settings.ImagesDir=adminPath+"images/";settings.PopupsDir=adminPath+"popups/";settings.CSSFile=adminPath+"styles/wysiwyg.css";settings.ImagePopupFile=adminPath+"popups/insert_image.php";settings.ImagePopupWidth=600;settings.ImagePopupHeight=245;settings.DocPopupFile=adminPath+"popups/insert_file.php";settings.DocPopupWidth=600;settings.DocPopupHeight=245;settings.Width="100%";settings.Height="400px";WYSIWYG.setSettings('Secondary_Content',settings);WYSIWYG._generate('Secondary_Content');}
function toggleLayer(whichLayer){var elem,vis;if(document.getElementById)
elem=document.getElementById(whichLayer);else if(document.all)
elem=document.all[whichLayer];else if(document.layers)
elem=document.layers[whichLayer];vis=elem.style;if(vis.display==''&&elem.offsetWidth!=undefined&&elem.offsetHeight!=undefined)
vis.display=(elem.offsetWidth!=0&&elem.offsetHeight!=0)?'block':'none';vis.display=(vis.display==''||vis.display=='block')?'none':'block';}
function popUp(URL){day=new Date();id=day.getTime();eval("page"+id+"=window.open(URL,'"+id+"','toolbar=0,scrollbars=0,location=0,statusbar=0,menubar=0,resizable=0,width=300,height=300,left=490,top=362');");}
function popUpPlayer(URL,width,height){day=new Date();id=day.getTime();eval("page"+id+"=window.open(URL,'"+id+"','toolbar=0,scrollbars=0,location=0,statusbar=0,menubar=0,resizable=0,width='+width+',height='+height+',left=490,top=362');");}
function addBookmark(title,url){if(window.sidebar)
window.sidebar.addPanel(title,url,"");else if(document.all)
window.external.AddFavorite(url,title);else if(window.opera&&window.print)
return true;}
function insertAtCursor(myField,myValue){if(document.selection){myField.focus();sel=document.selection.createRange();sel.text=myValue;}else if(myField.selectionStart||myField.selectionStart=='0'){var startPos=myField.selectionStart;var endPos=myField.selectionEnd;myField.value=myField.value.substring(0,startPos)
+myValue
+myField.value.substring(endPos,myField.value.length);}else myField.value+=myValue;}
function insertspecial(myField,ftag){var space=" ";if(ftag=='URL'){var url=prompt('Enter the URL:','http:\/\/');if(!url){return;}
var txt=prompt('Enter the text for the link or press enter to use the URL as the text:','Link Text');if(!txt||(txt=='Link Text')){txt=URL;}
insertAtCursor(myField,"[URL="+url+"]"+txt+"[/URL]");}else if(ftag=='YOUTUBE'){var text=prompt("Enter the YouTube Video URL (not the EMBED):","");if(text!=null){var text_to_insert='['+ftag+']'+text.substring(31)+'[/'+ftag+']';insertAtCursor(myField,text_to_insert);}}else if(ftag=='IMG'){var text=prompt("Enter the link to the image you would like to insert:",'http:\/\/');if(text!=null){var text_to_insert='['+ftag+']'+text+'[/'+ftag+']';insertAtCursor(myField,text_to_insert);}}else{var text=prompt("Type the text you want to enter:","");if(text!=null){var text_to_insert='['+ftag+']'+text+'[/'+ftag+']';insertAtCursor(myField,text_to_insert);}}
myField.focus();}
function displayOrder_Dropdown(pageLink){window.location=pageLink+'?sortOrder='+document.displayOrder.sortOrd.options[document.displayOrder.sortOrd.selectedIndex].value;}
function ValidateLogin(theForm){var why="";why+=isEmpty(theForm.access_login.value,'Login');why+=isEmpty(theForm.access_password.value,'Password');if(why!=""){alert(why);return false;}
return true;}
function ValidateEmail(theForm){var why="";why+=checkEmail(theForm.ml_Email.value);if(why!=""){alert(why);return false;}
return true;}
function make_blank(){document.SearchBox.words.value="";}
function checkEmail(strng){var error="";if(strng=="")
error="You didn't enter an email address.\n";var emailFilter=/^.+@.+\..{2,3}$/;if(!(emailFilter.test(strng)))
error="Please enter a valid email address.\n";else{var illegalChars="/[\(\)\<\>\,\;\:\\\"\[\]]/"
if(strng.match(illegalChars))
error="The email address contains illegal characters.\n";}
return error;}
function checkPhone(strng){var error="";var stripped=strng.replace(/[\(\)\.\-\ ]/g,'');if(strng=="")
error="You didn't enter a phone number.\n";else if(isNaN(parseInt(stripped)))
error="The phone number contains illegal characters.";else if(!(stripped.length==10))
error="The phone number is the wrong length. Make sure you included an area code.\n";return error;}
function checkZip(strng){var error="";var stripped=strng.replace(/[\(\)\.\-\ ]/g,'');if(strng=="")
error="You didn't enter a zip code.\n";else if(isNaN(parseInt(stripped)))
error="The zip code contains illegal characters.";else if(!(stripped.length==5))
error="The zip code should be 5 digits long.\n";return error;}
function checkPassword(strng){var error="";if(strng=="")
error="You didn't enter a password.\n";var illegalChars=/[\W_]/;if((strng.length<6)||(strng.length>10))
error="The password must be 6-10 characters long.\n";else if(illegalChars.test(strng))
error="The password contains illegal characters, only alphanumeric allowes.\n";else if(!((strng.search(/(a-z)+/))&&(strng.search(/(A-Z)+/))&&(strng.search(/(0-9)+/))))
error="The password must contain at least one uppercase letter, one lowercase letter, and one numeral.\n";return error;}
function checkRetype(strng,pwd){var error="";if(strng=="")
error="You didn't retype the password.\n";else if(strng!=pwd)
error="Passwords entered do not match.\n";return error;}
function checkRetypeEmail(strng,pwd){var error="";if(strng=="")
error="You didn't retype the email address.\n";else if(strng!=pwd)
error="Email Addresses entered do not match.\n";return error;}
function checkUsername(strng){var error="";if(strng=="")
error="You didn't enter a username.\n";var illegalChars=/\W/;if((strng.length<4)||(strng.length>20))
error="The username must be 4-20 characters long.\n";else if(illegalChars.test(strng))
error="The username contains illegal characters.\n";return error;}
function isEmpty(strng,fld){var error="";if(strng.length==0)
error="Please fill in the "+fld+".\n"
return error;}
function checkRadio(checkvalue){var error="";if(!(checkvalue))
error="Please check a radio button.\n";return error;}
function checkDropdown(choice,fld){var error="";if(choice==0)
error="You didn't choose an option from the "+fld+" drop-down list.\n";return error;}
function checkPageName(strng){var error="";if(strng=="")
error="You didn't enter a page name.\n";var illegalChars=/[^a-zA-Z0-9 ]/;if(illegalChars.test(strng))
error="The page name contains illegal characters.\n";return error;}
var wspmenu={downarrowpointer:["http://www.websitepyro.com/images/arrow-down.gif",11,7],rightarrowpointer:["http://www.websitepyro.com/images/arrow-right.gif",12,12],hideinterval:200,httpsiframesrc:"blank.htm",topmenuids:[],topitems:{},subuls:{},topitemsindex:-1,ulindex:-1,hidetimers:{},shimadded:false,getoffset:function(what,offsettype){return(what.offsetParent)?what[offsettype]+this.getoffset(what.offsetParent,offsettype):what[offsettype]},getoffsetof:function(el){el._offsets={left:this.getoffset(el,"offsetLeft"),top:this.getoffset(el,"offsetTop")}},getwindowsize:function(){this.docwidth=window.innerWidth?window.innerWidth-10:this.standardbody.clientWidth-10
this.docheight=window.innerHeight?window.innerHeight-15:this.standardbody.clientHeight-18},gettopitemsdimensions:function(){for(var m=0;m<this.topmenuids.length;m++){var topmenuid=this.topmenuids[m]
for(var i=0;i<this.topitems[topmenuid].length;i++){var header=this.topitems[topmenuid][i]
var submenu=document.getElementById(header.parentNode.getAttribute('rel'))
header._dimensions={w:header.offsetWidth,h:header.offsetHeight,submenuw:submenu.offsetWidth,submenuh:submenu.offsetHeight}}}},isContained:function(m,e){var e=window.event||e
var c=e.relatedTarget||((e.type=="mouseover")?e.fromElement:e.toElement)
while(c&&c!=m)try{c=c.parentNode}catch(e){c=m}
if(c==m)
return true
else
return false},addpointer:function(target,imgclass,imginfo){var pointer=document.createElement("img")
pointer.src=imginfo[0]
pointer.style.width=imginfo[1]+"px"
pointer.style.height=imginfo[2]+"px"
pointer.className=imgclass
target.appendChild(pointer)},css:function(el,targetclass,action){var needle=new RegExp("(^|\\s+)"+targetclass+"($|\\s+)","ig")
if(action=="check")
return needle.test(el.className)
else if(action=="remove")
el.className=el.className.replace(needle,"")
else if(action=="add"&&!needle.test(el.className))
el.className+=" "+targetclass},addshimmy:function(target){var shim=(!window.opera)?document.createElement("iframe"):document.createElement("div")
shim.className="ddiframeshim"
shim.setAttribute("src",location.protocol=="https:"?this.httpsiframesrc:"about:blank")
shim.setAttribute("frameborder","0")
target.appendChild(shim)
try{shim.style.filter='progid:DXImageTransform.Microsoft.Alpha(style=0,opacity=0)'}
catch(e){}
return shim},positionshim:function(header,submenu,dir,scrollX,scrollY){if(header._istoplevel){var scrollY=window.pageYOffset?window.pageYOffset:this.standardbody.scrollTop
var topgap=header._offsets.top-scrollY
var bottomgap=scrollY+this.docheight-header._offsets.top-header._dimensions.h
if(topgap>0){this.shimmy.topshim.style.left=scrollX+"px"
this.shimmy.topshim.style.top=scrollY+"px"
this.shimmy.topshim.style.width="99%"
this.shimmy.topshim.style.height=topgap+"px"}
if(bottomgap>0){this.shimmy.bottomshim.style.left=scrollX+"px"
this.shimmy.bottomshim.style.top=header._offsets.top+header._dimensions.h+"px"
this.shimmy.bottomshim.style.width="99%"
this.shimmy.bottomshim.style.height=bottomgap+"px"}}},hideshim:function(){this.shimmy.topshim.style.width=this.shimmy.bottomshim.style.width=0
this.shimmy.topshim.style.height=this.shimmy.bottomshim.style.height=0},buildmenu:function(mainmenuid,header,submenu,submenupos,istoplevel,dir){header._master=mainmenuid
header._pos=submenupos
header._istoplevel=istoplevel
if(istoplevel){this.addEvent(header,function(e){wspmenu.hidemenu(wspmenu.subuls[this._master][parseInt(this._pos)])},"click")}
this.subuls[mainmenuid][submenupos]=submenu
header._dimensions={w:header.offsetWidth,h:header.offsetHeight,submenuw:submenu.offsetWidth,submenuh:submenu.offsetHeight}
this.getoffsetof(header)
submenu.style.left=0
submenu.style.top=0
submenu.style.visibility="hidden"
this.addEvent(header,function(e){if(!wspmenu.isContained(this,e)){if(typeof wspmenu.hidetimers[this._master][parseInt(this._pos)]!="undefined")
clearTimeout(wspmenu.hidetimers[this._master][parseInt(this._pos)])
if(this._istoplevel)
wspmenu.css(this,"selected","add")
var submenu=wspmenu.subuls[this._master][parseInt(this._pos)]
wspmenu.getoffsetof(header)
var scrollX=window.pageXOffset?window.pageXOffset:wspmenu.standardbody.scrollLeft
var scrollY=window.pageYOffset?window.pageYOffset:wspmenu.standardbody.scrollTop
var submenurightedge=this._offsets.left+this._dimensions.submenuw+(this._istoplevel&&dir=="topbar"?0:this._dimensions.w)
var submenubottomedge=this._offsets.top+this._dimensions.submenuh
var menuleft=(this._istoplevel?this._offsets.left+(dir=="sidebar"?this._dimensions.w:0):this._dimensions.w)
if(submenurightedge-scrollX>wspmenu.docwidth){menuleft+=-this._dimensions.submenuw+(this._istoplevel&&dir=="topbar"?this._dimensions.w:-this._dimensions.w)}
submenu.style.left=menuleft+"px"
var menutop=(this._istoplevel?this._offsets.top+(dir=="sidebar"?0:this._dimensions.h):this.offsetTop)
if(submenubottomedge-scrollY>wspmenu.docheight){if(this._dimensions.submenuh<this._offsets.top+(dir=="sidebar"?this._dimensions.h:0)-scrollY){menutop+=-this._dimensions.submenuh+(this._istoplevel&&dir=="topbar"?-this._dimensions.h:this._dimensions.h)}
else{menutop+=-(this._offsets.top-scrollY)+(this._istoplevel&&dir=="topbar"?-this._dimensions.h:0)}}
submenu.style.top=menutop+"px"
wspmenu.positionshim(this,submenu,dir,scrollX,scrollY)
submenu.style.visibility="visible"}},"mouseover")
this.addEvent(header,function(e){if(this._istoplevel){var submenu=wspmenu.subuls[this._master][parseInt(this._pos)]
if(!wspmenu.isContained(this,e)&&!wspmenu.isContained(submenu,e))
wspmenu.hidemenu(submenu)}
else if(!this._istoplevel&&!wspmenu.isContained(this,e)){var headerlist=this
wspmenu.hidetimers[this._master][parseInt(this._pos)]=setTimeout(function(){var submenu=wspmenu.subuls[headerlist._master][parseInt(headerlist._pos)]
wspmenu.hidemenu(submenu)},wspmenu.hideinterval)}},"mouseout")},hidemenu:function(submenu){if(typeof submenu._pos!="undefined"){this.css(this.topitems[submenu._master][parseInt(submenu._pos)],"selected","remove")
this.hideshim()}
submenu.style.left=0
submenu.style.top="-1000px"
submenu.style.visibility="hidden"},addEvent:function(target,functionref,tasktype){if(target.addEventListener)
target.addEventListener(tasktype,functionref,false);else if(target.attachEvent)
target.attachEvent('on'+tasktype,function(){return functionref.call(target,window.event)});},init:function(mainmenuid,dir){this.standardbody=(document.compatMode=="CSS1Compat")?document.documentElement:document.body
this.topitemsindex=-1
this.ulindex=-1
this.topmenuids.push(mainmenuid)
this.topitems[mainmenuid]=[]
this.subuls[mainmenuid]=[]
this.hidetimers[mainmenuid]=[]
if(!this.shimadded){this.shimmy={}
this.shimmy.topshim=this.addshimmy(document.body)
this.shimmy.bottomshim=this.addshimmy(document.body)
this.shimadded=true}
var menubar=document.getElementById(mainmenuid)
var menuitems=menubar.getElementsByTagName("*")
this.getwindowsize()
for(var i=0;i<menuitems.length;i++){if(menuitems[i].getAttribute('rel')){this.topitemsindex++
this.ulindex++
var menulink=menuitems[i].getElementsByTagName("a")[0]
this.topitems[mainmenuid][this.topitemsindex]=menulink
var dropul=document.getElementById(menuitems[i].getAttribute('rel'))
dropul.style.zIndex=2000
dropul._master=mainmenuid
dropul._pos=this.topitemsindex
this.addEvent(dropul,function(){wspmenu.hidemenu(this)},"click")
var arrowpointer=(dir=="sidebar")?"rightarrowpointer":"downarrowpointer"
this.addpointer(menulink,arrowpointer,this[arrowpointer])
this.buildmenu(mainmenuid,menulink,dropul,this.ulindex,true,dir)
this.addEvent(dropul,function(e){if(!wspmenu.isContained(this,e)&&!wspmenu.isContained(wspmenu.topitems[this._master][parseInt(this._pos)],e)){var dropul=this
wspmenu.hidetimers[this._master][parseInt(this._pos)]=setTimeout(function(){wspmenu.hidemenu(dropul)},wspmenu.hideinterval)}},"mouseout")
var subuls=dropul.getElementsByTagName("ul")
for(var c=0;c<subuls.length;c++){this.ulindex++
var parentli=subuls[c].parentNode
this.addpointer(parentli.getElementsByTagName("a")[0],"rightarrowpointer",this.rightarrowpointer)
this.buildmenu(mainmenuid,parentli,subuls[c],this.ulindex,false,dir)}}}
this.addEvent(window,function(){wspmenu.getwindowsize();wspmenu.gettopitemsdimensions()},"resize")},setup:function(mainmenuid,dir){this.addEvent(window,function(){wspmenu.init(mainmenuid,dir)},"load")}}