// standard functions
window.onMouseMove = mouser;
window.onLoad = PreLoadImg;
function PreLoadImg(){MM_preloadImages("../images/close.png","../images/popdivsframe/bottom.png","../images/popdivsframe/bottomleft.png","../images/popdivsframe/bottomright.png","../images/popdivsframe/left.png","../images/popdivsframe/right.png","../images/popdivsframe/top.png","../images/popdivsframe/topleft.png","../images/popdivsframe/topright.png","../images/loading.gif");}
function MM_swapImgRestore() {var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;}
function MM_preloadImages() {var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();var i,j=d.MM_p.length,a=MM_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 MM_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=MM_findObj(n,d.layers[i].document); return x;}
function MM_swapImage() {var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}}

function GetXmlHttpObject(){if (window.XMLHttpRequest){return new XMLHttpRequest();}if (window.ActiveXObject){return new ActiveXObject("Microsoft.XMLHTTP");}return null;}

var xmlhttp_divpopup;
function divpopup(themethod,theurl,atclicksend){if(atclicksend){MoveDivToClick("PopDiv");}if (themethod.length == 0 || theurl.length == 0){document.getElementById("PopDiv").innerHTML = "";hide("PopDiv");return;}xmlhttp_divpopup = GetXmlHttpObject();if (xmlhttp_divpopup == null){alert ("Your browser does not support XMLHTTP!");return;}xmlhttp_divpopup.onreadystatechange = stateChanged_divpopup;xmlhttp_divpopup.open(themethod,theurl,true);xmlhttp_divpopup.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');xmlhttp_divpopup.send(theurl);}
function stateChanged_divpopup(){if (xmlhttp_divpopup.readyState == 1){dispload("PopDiv","","w");}if (xmlhttp_divpopup.readyState == 4){disp("PopDiv");document.getElementById("PopDiv").innerHTML = xmlhttp_divpopup.responseText;}}
var loadingpic = "<center><div class=\"loadingpic\"></div></center>";
var loadingwindow = "<table cellpadding=\"0\" cellspacing=\"0\" border=\"0\"><tr><td class=\"PopDivFrameTopLeft\">&nbsp;&nbsp;&nbsp;</td><td class=\"PopDivFrameTop\"></td><td class=\"PopDivFrameTopRight\">&nbsp;&nbsp;&nbsp;</td></tr><tr><td class=\"PopDivFrameLeft\">&nbsp;&nbsp;&nbsp;</td><td class=\"PopDivFrameBg\"><table cellpadding=\"0\" cellspacing=\"0\" border=\"0\" style=\"width: 100%;\"><tr><td class=\"popDivTopBar\" onmousedown=\"return MoveDiv('PopDiv');\" onmouseup=\"return StopDiv('PopDiv');\"><table cellpadding=\"2\" cellspacing=\"0\" border=\"0\" style=\"width: 100%;\"><tr><td style=\"text-align: left; font-size: 14px; color: #ffffff;\"><b>Loading...</b></td><td style=\"text-align: right;\"><input type=\"button\" class=\"popDivCloseBut\" value=\" \" title=\"close\" onclick=\"javascript:ClosePopDiv();\" /></td></tr></table></td></tr><tr><td style=\"width: 200px; height: 100px; vertical-align: middle; text-align: center;\">" + loadingpic + "</td></tr></table></td><td class=\"PopDivFrameRight\">&nbsp;&nbsp;&nbsp;</td></tr><tr><td class=\"PopDivFrameBottomLeft\">&nbsp;&nbsp;&nbsp;</td><td class=\"PopDivFrameBottom\"></td><td class=\"PopDivFrameBottomRight\">&nbsp;&nbsp;&nbsp;</td></tr></table>";
var posx;var posy;var DivX = 150;var DivY = 50;var xmlhttp;var DivClkLft;var DivClkRgt;var moveX;var moveY;
function mouser(event){posx = event.clientX;posy = event.clientY;}
function dispload(divID,Msg,dw){disp(divID);if(dw=="d"){GetElm(divID).innerHTML = "<center>" + loadingpic + "<br/><b>" + Msg + "</b></center>";}else if(dw=="w"){GetElm(divID).innerHTML = loadingwindow;}}
function MoveDivToClick(divID){if (!posx){posx = 150;}if (!posy){posy = 50;}moveX = posx;moveY = posy;DivX = posx;DivY = posy;document.getElementById(divID).style.left = DivX + "px";document.getElementById(divID).style.top = DivY + "px";}
function MoveDiv(divID){dsblSlct(document.body);DivClkLft = posx - DivX;DivClkRgt = posy - DivY;document.onmousemove = MovemyDiv;function MovemyDiv(){moveX = posx - DivClkLft;moveY = posy - DivClkRgt;DivX = moveX;DivY = moveY;document.getElementById(divID).style.left = moveX + "px";document.getElementById(divID).style.top = moveY + "px";}}
function StopDiv(divID){enblSlct(document.body);document.onmousemove = StopmyDiv;function StopmyDiv(){if (moveX != null && moveY != null){if (document.getElementById(divID).style.visibility != 'hidden'){DivX = moveX;DivY = moveY;} else {DivX = DivX;DivY = DivY;}document.getElementById(divID).style.left = moveX + "px";document.getElementById(divID).style.top = moveY + "px";}}}
function ClosePopDiv(){document.getElementById("PopDiv").innerHTML = "";hide("PopDiv");}
function dsblSlct(trgt){if (typeof trgt.onselectstart!="undefined"){trgt.onselectstart=function(){return false};}else if (typeof trgt.style.MozUserSelect!="undefined"){trgt.setAttribute("class","moznone");document.getElementById("PopDiv").setAttribute("class","PopDivNotSelect");}else{trgt.onmousedown=function(){return false};trgt.style.cursor = "default";}}
function enblSlct(trgt){if (typeof trgt.onselectstart!="undefined"){trgt.onselectstart=function(){return true};}else if (typeof trgt.style.MozUserSelect!="undefined"){trgt.setAttribute("class","moztext");document.getElementById("PopDiv").setAttribute("class","PopDiv");}else{trgt.onmousedown=function(){return true};trgt.style.cursor = "select";}}
function disp(div){document.getElementById(div).style.display="block";}
function hide(div){document.getElementById(div).style.display="none";}
function confirmAct(){var conf = confirm("Are you sure you want to take this action?");if(true == conf){return true;}else if(false == conf){return false;}}
function confirmDel(){var conf = confirm("Are you sure you want to delete the selected items?");if(true == conf){return true;}else if(false == conf){return false;}}
function fixForURL(val){return escape(encodeURI(val));}
function GetElm(fld){return document.getElementById(fld);}
function GetElmVal(fld){if(document.getElementById(fld)){return document.getElementById(fld).value;}}
function Trim(s) {while ((s.substring(0,1) == ' ') || (s.substring(0,1) == '\n') || (s.substring(0,1) == '\r')){ s = s.substring(1,s.length); }while ((s.substring(s.length-1,s.length) == ' ') || (s.substring(s.length-1,s.length) == '\n') || (s.substring(s.length-1,s.length) == '\r')){ s = s.substring(0,s.length-1); }return s;}

// website-specific functions
function popitupCal(url) {
	newwindow=window.open(url,'add','height=700,width=830');
	if (window.focus) {newwindow.focus()}
	return false;
}
function checkLogin(form){
	var un = form.un;
	var pwd = form.pwd;
	if (un.value == ""){alert('Username Required!');un.focus();return false;}
	if (pwd.value == ""){alert('Password Required!');pwd.focus();return false;}
	return true;
}
function CheckEvent(form){
	var category = form.category;
	var mytitle = form.mytitle;
	var alttag = form.alttag;
	if (category.value == ""){alert('Category Required!');return false;}
	if (mytitle.value == ""){alert('Title Required!');mytitle.focus();return false;}
	if (alttag.value == ""){alert('Alt Tag Required!');alttag.focus();return false;}
	return true;
}
function CheckCat(form){
	var mytitle = form.mytitle;
	if (mytitle.value == ""){alert('Title Required!');mytitle.focus();return false;}
	return true;
}
function CheckProfile(form){
	var mytitle = form.mytitle;
	var company = form.company;
	var descrip = form.descrip;
	if (mytitle.value == ""){alert('Name Required!');mytitle.focus();return false;}
	if (company.value == ""){alert('Company Required!');company.focus();return false;}
	if (descrip.value == ""){alert('Description Required!');descrip.focus();return false;}
	return true;
}
function CheckDvd(form){
	var category = form.category;
	var mytitle = form.mytitle;
	var descrip = form.descrip;
	if (category.value == ""){alert('Category Required!');return false;}
	if (mytitle.value == ""){alert('Title Required!');mytitle.focus();return false;}
	if (descrip.value == ""){alert('Code Required!');descrip.focus();return false;}
	return true;
}
function confirmDel()
{
    var conf = confirm("Are you sure you want to delete this item and all information relating to it?");
    if(true == conf){return true;}else if(false == conf){return false;}
}
