//	SWG Menu Code
//	SWG Content Mangement System 2.0
//	Copyright © 2005 Super Web Group.  All Rights Reserved.
//	info@superwebgroup.com

function pop(vURL,w,h) {
	var temp_url = vURL;
	var new_win = window.open(temp_url, "pop"+w+h, 'toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=yes,resizable=yes,width='+w+',height='+h+',left=0,top=0,alwaysRaised=yes');
	new_win.focus();
}

function external_site(vURL) {
	var temp_url = "externalsite.html?URL="+vURL;
	var new_win = window.open(temp_url, "pop_external", 'toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=yes,resizable=yes,width=950,height=750,left=0,top=0,alwaysRaised=yes');
	new_win.focus();
}

function tracker(pid) {
	if (screen) { sr = screen.width + 'x' + screen.height; } else { sr = ''; }
	if (navigator) { bt = navigator.appName; bv = navigator.appVersion; bp = navigator.platform; } else { bt = ''; bv = ''; bp = ''; }
	document.write('<div style="position:absolute; visibility:hidden;"><img src="http://www.superwebgroup.com/public/hittracker.asp?pid='+ pid +'&sr=' + escape(sr) + '&bt=' + escape(bt) + '&bv=' + escape(bv) + '&bp=' + escape(bp) + '" height=1 width=1 border=0></div>');
}

function logout() {
	if (confirm('Are you sure you want to Sign Out?')){
		top.location = 'logout.asp';
	}
}

function date_check(m, d, y) {
	if (isNaN(m) || isNaN(d) || isNaN(y)) return false;
	if (m < 1 || m > 12 || d < 1 || d > 31 || y < 2000) return false;
	if ((m == 4 || m == 6 || m == 9 || m == 11) && (d > 30)) return false;
	if (m == 2) {
		if (y % 4 == 0) {
			if (d > 29) return false;
		} else {
			if (d > 28) return false;
		}
	}
	return true;
}

function check_search() {
	form = document.search_form;
	if (form.SearchTerm.value == '' || form.SearchTerm.value == 'type here' || form.SearchTerm.value == 'type keyword here') {
		alert('Please enter a search term and then try again.');
	} else {
		form.submit();
	}
}

function DisplayMail(Server, Login, Subject, Display){
	if (Subject.length >= 1){Subject = "?Subject="+escape(Subject)};
	if ((Display.length == 0) || (Display.indexOf('@')+1)) {
	document.write("<A HREF=" + "'mai" + "lto:" + Login + "@" + Server + Subject + "'>" + Login + "@" + Server + "</A>"); 
	} else  {
	document.write("<A HREF=" + "'mai" + "lto:" + Login + "@" + Server + Subject + "'>" + Display + "</A>"); 
	}
}

function ViewPDF(pdfurl){
	var temp_url = pdfurl;
	var new_win = window.open(temp_url, "pdf", 'toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=yes,resizable=yes,width=700,height=600,left=0,top=0,alwaysRaised=yes');
	new_win.focus();
}

function SwapContent(fromdiv,todiv){
	if (document.getElementById)
	{
	   document.getElementById(todiv).innerHTML = document.getElementById(fromdiv).innerHTML;
	}
	else if (document.all)
	{
	   document.all[todiv].innerHTML = document.all[fromdiv].innerHTML;
	}
	else if (document.layers)
	{
	   if (document.layers[fromdiv])
	   {
	   	document.layers[todiv].innerHTML = document.layers[fromdiv].innerHTML;
	   }
	}
 }

function PrintReady(page){
	var new_win = window.open(page, 'printpage', 'toolbar=no,location=no,directories=no,status=no,menubar=yes,scrollbars=yes,resizable=yes,width=820,height=700,alwaysRaised=yes');
	new_win.focus();
}

function printpage(){
 	if (is_mac && is_ie){
		alert("We are sorry, but your browser does not support this command. You must select the File menu's Print command instead.");
	} else {
	   window.print();
	}
}

function DivPosition(div,mody,modx)
{
	var x = new getObj(div);
	if (mody != ''){ 
		x.style.top = mody + 'px';
	}
	if (modx != ''){ 
		x.style.left = modx + 'px';
	}
}

function Random(N) {
    return (N * (Math.random() % 1)) | 0;
}
function RanSpan(MinV, MaxV) {
    return MinV + Random(MaxV - MinV + 1);
}

function CycleImages(ArrayName){
    var iCount = 0
    var src = ""
    var j = 0
    if(document.images) {
        iCount = eval("Img_"+ArrayName+"_Count")
        j = RanSpan(0,iCount-1);
        if (document.getElementById(ArrayName)){
            img = document.getElementById(ArrayName);
            img.src = eval("Img_"+ArrayName+"["+j+"].src;");
        }
    }
}

function PlaceImage(ArrayName){
    var iCount = 0
    var src = ""
    var j = 0
    if(document.images) {
        iCount = eval("Img_"+ArrayName+"_Count")
        j = RanSpan(0,iCount-1);
        src = eval("Img_"+ArrayName+"["+j+"].src;");
        document.write('<img src="'+src+'" hspace="0" vspace="0" border="0" id="'+ArrayName+'" alt="" />');
    }
}

function newImage(arg) {
	if (document.images) {
		rslt = new Image();
		rslt.src = arg;
		return rslt;
	}
}

function VerifyEditorCheck(){
   if (document.EditorCheckForm.Password.value == ''){
       alert('Please enter your password to accept these changes.');
       return false;
   } else {
       return true;
   }
}