function addEditor(idd) {
	var elm = document.getElementById(idd);

	//if (tinyMCE.getInstanceById(idd) == null)
		//tinyMCE.execCommand('mceRemoveControl', false, idd);
		tinyMCE.execCommand('mceAddControl', false, idd);
	//else
		//tinyMCE.execCommand('mceRemoveControl', false, idd);
}
function renderEditor() {
	tinyMCE.triggerSave();
}
function gotoPage(pagee) {
	document.location = pagee;	
}
function hidediv(idd) {
	//safe function to hide an element with a specified id
	if (this.document.getElementById) { // DOM3 = IE5, NS6
		this.document.getElementById(idd).style.display = 'none';
	}
	else {
		if (this.document.layers) { // Netscape 4
			this.document.idd.display = 'none';
		}
		else { // IE 4
			this.document.all.idd.style.display = 'none';
		}
	}
}

function showdiv(idd) {
	//safe function to show an element with a specified id
		  
	if (this.document.getElementById) { // DOM3 = IE5, NS6
		this.document.getElementById(idd).style.display = 'block';
	} else {
		if (this.document.layers) { // Netscape 4
			this.document.idd.display = 'block';
		}
		else { // IE 4
			this.document.all.idd.style.display = 'block';

		}
	}
}
function showMsg(divNa) {
	alert(document.getElementById(divNa).value);
	alert(document.getElementById(divNa).innerHTML);
}
function setWaitMessage (divNa, submitBtn) {
	document.getElementById(divNa).innerHTML = "<font color='red'>Please Wait... Loading <img src='http://www.images.webcadets.com/folderlist/working.gif' alt='Loading' /></font>";
	if(submitBtn)
		document.getElementById(submitBtn).disabled = true;
}
function enableBtn(submitBtn) {
	document.getElementById(submitBtn).enabled = true;
	document.getElementById(submitBtn).disabled = false;
}
function removeAllEditors(opttype, formna) {
	var elem = document.getElementById(formna).elements;
	for(var i = 0; i < elem.length; i++) {
		if(elem[i].type == "textarea") {
			if (tinyMCE.getInstanceById(elem[i].name) == null && opttype == 'mceRemoveControl') {
				//tinyMCE.execCommand(opttype, false, elem[i].name);
			}else {
				if (elem[i].className == 'mceNoEditor' && opttype == 'mceAddControl') {
					tinyMCE.execCommand(opttype, true, elem[i].name);
				}else {
					tinyMCE.execCommand(opttype, false, elem[i].name);
				}
			}
		}
	}
}

function addslashes(str) {
	str=str.replace(/\'/g,'\\\'');
	str=str.replace(/\"/g,'\\"');
	str=str.replace(/\\/g,'\\\\');
	//str=str.replace(/\0/g,'\\0');
	return str;
}
function stripslashes(str) {
	str=str.replace(/\\'/g,'\'');
	str=str.replace(/\\"/g,'"');
	str=str.replace(/\\\\/g,'\\');
	//str=str.replace(/\\0/g,'\0');
	return str;
}
function MM_jumpMenu(targ,selObj,restore){ //v3.0
  eval(targ+".location='"+selObj.options[selObj.selectedIndex].value+"'");
  if (restore) selObj.selectedIndex=0;
}

/*
image1 = new Image();
image1.src = "";

image2 = new Image();
image2.src = "";
*/
var preload1=new Image();
preload1.src="http://webcadets.com/forum/images/wcc/buttons/collapse_thead_collapsed.gif";

var preload2=new Image();
preload2.src="http://webcadets.com/forum/images/wcc/buttons/collapse_thead.gif";


function CalculateTotal (fieldName, subTotal) {
	x = parseInt(subTotal);
	y = parseInt(document.getElementById(fieldName + "_Misc").value);
	z = parseInt(x+y);
	document.getElementById(fieldName + "_Total").value = z;
}
function checkreportsubmissionform() {
	var submitform = true;
	var ReportType		= window.document.form1.ReportType.value;
	var Department		= window.document.form1.Department.value;
	var ReportFor		= window.document.form1.ReportFor.value;
	var ReportSubject	= window.document.form1.ReportSubject.value;

	if (submitform == true && (ReportType == false || ReportType == "")) {
		alert("You Must Select a Report Type.");
		return false;
	}else if (submitform == true && ReportType != "Corps Status Report" && (Department == false || Department == "")) {
		alert("You Must Select a Department.");
		return false;
	}else if (submitform == true && (ReportFor == false || ReportFor == "")) {
		alert("You Must Select a Reporting Period.");
		return false;
	}else if (submitform == true && (ReportSubject == false || ReportSubject == "")) {
		alert("You Must Enter A Report Subject.");
		return false;
	}

	return true;
}
function loginChange(formName, buttonName, valueStr) {
	var nameF = formName;
	var nameB = buttonName;
	var newStr2 = buttonName + "_" + formName + "_" + valueStr;
	var newStr3 = buttonName + "_" + formName + "_" + valueStr + "_true";
	var newStr4 = buttonName + "_" + formName + "_" + valueStr + "_fake";
	var newStr = "SubmitWorking_" + nameF + "_" + valueStr;
	//document.getElementById(newStr2).value = "Submitting...";
	
	//Hide Legit Submit Button
	var elements22 = document.getElementsByTagName("div");

	for(var i = 0; i<elements22.length; i++) {
		if (elements22[i].id == newStr3) {
			elements22[i].style.display = 'none';
		}
	}
	//hidediv(newStr3);

	for(var i = 0; i<elements22.length; i++) {
		if (elements22[i].id == newStr4) {
			elements22[i].style.display = 'block';
		}
	}
	for(var i = 0; i<elements22.length; i++) {
		if (elements22[i].id == newStr) {
			elements22[i].style.display = 'block';
		}
	}
	// Shows Image
	//showdiv(newStr);
}
/*
Advanced Email Check
By Website Abstraction (http://www.wsabstract.com) and
Java-Scripts.net (http://www.java-scripts.net)
Over 200+ free scripts here!
*/
var testresults;
function checkemail(value22){
	var str = document.LoginForm.vb_login_username.value;
	str = value22;
	var filter=/^([\w-]+(?:\.[\w-]+)*)@((?:[\w-]+\.)*\w[\w-]{0,66})\.([a-z]{2,6}(?:\.[a-z]{2})?)$/i;
	//alert(str);
	if (filter.test(str)) {
		testresults=true;
		document.LoginForm.actionnn[0].checked = true;
		document.LoginForm.actionn.value = "mywcc";
		//alert("mywcc!");
	}else {
		//document.login.actionnn[1].checked = true;
		//document.login.actionn.value = "forums";
		testresults=false;
	}
	/*
	document.LoginForm.LoginButton.value = "Loging In...";
	document.LoginForm.LoginButton.disabled = true;
	//this.document.LoginWorking.style.display = 
	showdiv('LoginWorking');
	return (testresults);
	*/
}
//  End -->

function formSubmit(formName){
  var name22 = formName;
  document.name22.submit();
}
function getElementsByClassName(oElm, strTagName, strClassName){
    var arrElements = (strTagName == "*" && oElm.all)? oElm.all : oElm.getElementsByTagName(strTagName);
    var arrReturnElements = new Array();
    strClassName = strClassName.replace(/\-/g, "\\-");
    var oRegExp = new RegExp("(^|\\s)" + strClassName + "(\\s|$)");
    var oElement;
    for(var i=0; i<arrElements.length; i++){
        oElement = arrElements[i];      
        if(oRegExp.test(oElement.className)){
            arrReturnElements.push(oElement);
        }   
    }
    return (arrReturnElements);
}
function changediv2(id22) {
	if (this.document.getElementById(id22).style.display == 'none') {
		showdiv(id22);
	}else {
		hidediv(id22);
	}
}
function getLinkChange(loggedInShowValue) {
	//alert("Start: " + elements.length);
	var badPics = 0;
	var goodPics = 0;
	
	var links22 = document.getElementsByTagName("a");
	if (loggedInShowValue == "true") {
		for(var i = 0; i<links22.length; i++) {
			var str = links22[i].href;
			var index1 = str.indexOf("webcadets.com");
			var index2 = str.indexOf("javascript:");
			var index3 = str.indexOf("javascript:");
			var index4 = str.indexOf("w3.org");
			//alert(links[i].href)
			if (links22[i].href == "" || links22[i].href == '' ) {
				
			}else if (index1 >= 0 || index2 >= 0 || index3 >= 0 || index4 >= 0) {
				//alert("str: " + str);
				//alert("Index1: " + index1);
				//alert("Index2: " + index2);
				//alert("Index3: " + index3);
			}else {
				var newStr = "http://www.mywcc.webcadets.com/leaving_site.php?link=" + links22[i].href;
				links22[i].href = newStr;
				//document.write("Str: " + str + " => index1 (" + index1 + ") => index2 (" + index2 + ") => index3 (" + index3 + ")<br />");
				
				//elements[i].style.display = 'none';
				//arrayInfo.push(elements[i].src);
				//badPics++;
				//elements[i].src = 'none';
				//alert("Bad Image: " + elements[i].src);
			}
			//hidediv(elements[i].id);
		}
	}
	//alert("Ended: " + i);
}
function getImgElements(user) {
	var elements22 = getElementsByClassName(document, "img", "");
	//alert("Start: " + elements.length);
	var badPics = 0;
	var total = elements22.length;
	var goodPics = 0;
	var arrayInfo = new Array();
	for (i = 0; i < (elements22.length); i++) {
		var str = elements22[i].src;
		var index1 = str.indexOf("webcadets.com/forum");
		var index2 = str.indexOf("images.webcadets.com");
		var index3 = str.indexOf("pers.webcadets.com");
		var index4 = str.indexOf("newsletter.webcadets.com");
		var index5 = str.indexOf("webcadets.com/images");
		var index6 = str.indexOf("mywcc.webcadets.com");
		var index7 = str.indexOf("javascript.internet.com");
		var index8 = str.indexOf("lasvegassun.com/from.ed/2007/sep/01/photos");
		var index8 = str.indexOf("http://www.youtube.com/watch?v=PfXDKtESwxw");
		var index9 = str.indexOf("http://api.hostip.info/images/flags/");
		if (index1 >= 0 || index2 >= 0 || index3 >= 0 || index4 >= 0 || index5 >= 0 || index6 >= 0 || index7 >= 0 || index8 >= 0 || index9 >= 0) {
			//alert("Good Image: " + elements[i].src);
			goodPics++;
		}else {
			elements22[i].style.display = 'none';
			arrayInfo.push(elements22[i].src);
			badPics++;
			//elements[i].src = 'none';
			//alert("Bad Image: " + elements[i].src);
		}
		//hidediv(elements[i].id);
	}
	if (arrayInfo.length > 0 && user == 'FULLACCESS') {
		this.document.write("Images Not Stored On The Server:<br />");	

		for (i = 0; i < arrayInfo.length; i++) {
			//alert(arrayInfo[i]);
			this.document.write(arrayInfo[i] + "<br />");	
		}
	}
	if (user == 'FULLACCESS') {
		this.document.write("PICTURES_TOTAL_LINKS: " + total + "<br />");
		this.document.write("PICTURES_BAD_LINKS: " + badPics + "<br />");
		this.document.write("PICTURES_GOOD_LINKS: " + goodPics + "<br />");
	}
	setCookie("PICTURES_GOOD_LINKS", goodPics, '', "", "webcadets.com", 0);
	setCookie("PICTURES_BAD_LINKS", badPics, '', "", "webcadets.com", 0);
	setCookie("PICTURES_TOTAL_LINKS", total, '', "", "webcadets.com", 0);
	//alert("Ended: " + i);
}
function setMemberClass(forceNa) {
	setCookie("MemberClass", forceNa, '', "", "webcadets.com", 0);
}
function setForce(forceNa) {
	setCookie("Force", forceNa, '', "", "webcadets.com", 0);
}
function changedivAll(id22, className22) {
	var elements22 = getElementsByClassName(document, "div", className22);
	for (i = 0; i < elements22.length; i++) {
		//alert("Hiding: " + elements[i].id);
		hidediv(elements22[i].id);
	}
	showdiv(id22);
	//if (this.document.getElementById(id).style.display == 'none') {
		//showdiv(id);		
	//}else {
		//hidedivAll(id);
		//showdiv(id);		
	//}
}
function move_in(img_name,img_src) {
	document[img_name].src=img_src;
	this.document[img_name].src=img_src;
	this.document.images[img_name].src=img_src;
	document.images[img_name].src=img_src;
}

function move_out(img_name,img_src) {
	document[img_name].src=img_src;
	this.document[img_name].src=img_src;
	this.document.images[img_name].src=img_src;
	document.images[img_name].src=img_src;
}
function changediv(id22) {
	//var elements = getElementsByClassName(document, "img", 'Image_Collapse');
	//safe function to hide an element with a specified id
	if (this.document.getElementById(id22).style.display == 'none') {
		//alert("Before: " + document.images['Image_Collapse'].src);
		document.images['Image_Collapse'].src = "http://webcadets.com/forum/images/wcc/buttons/collapse_thead.gif";
		//alert("After: " + document.images['Image_Collapse'].src);
		showdiv(id22);
		//this.document.getElementById('Name'+id).innerText = "Colapse";
	}else {
		document.images['Image_Collapse'].src = "http://webcadets.com/forum/images/wcc/buttons/collapse_thead_collapsed.gif";
		hidediv(id22);
		//this.document.getElementById('Name'+id).innerText = "Expand";
		//document.getElementById('Name'+id).firstChild.nodeValue = "Expand";
	}
}
function changediv2(id22) {
	//var elements = getElementsByClassName(document, "div", '');
	//safe function to hide an element with a specified id
	if (this.document.getElementById(id22).style.display == 'none') {
		//alert("Before: " + document.images['Image_Collapse'].src);
		//document.images['Image_Collapse'].src = "http://webcadets.com/forum/images/wcc/buttons/collapse_thead.gif";
		//alert("After: " + document.images['Image_Collapse'].src);
		showdiv(id22);
		//this.document.getElementById('Name'+id).innerText = "Colapse";
	}else {
		//document.images['Image_Collapse'].src = "http://webcadets.com/forum/images/wcc/buttons/collapse_thead_collapsed.gif";
		hidediv(id22);
		//this.document.getElementById('Name'+id).innerText = "Expand";
		//document.getElementById('Name'+id).firstChild.nodeValue = "Expand";
	}
}
function divchange(id22) {
	if(this.document.getElementById(id22).style.display = 'none') {
		showdiv(id22);
	}else {
		hidediv(id22);
	}
}
/* NCOC Scripts */
function confirmCourseRemove() {
	var agree=confirm("Removing The Course Will Do The Following:\n\n1) Remove All Assignments Related To The Course\n2) Remove All Students Related To The Course\n3) Will Reset A Member's Medal If They Were Awarded A Honours Pass\n4) Will Remove From The Credits List");
	if (agree)
		return true;
	else
		return false;
}
function confirmStudentRemove(form22) {
	/*
	if (form.Change.value != 'Remove Student') {
		alert('A ' + form22.Change.value);
		return false;	
	}else {
		alert('B ' + form22.Change.value);
		*/
		var agree=confirm("Removing The Student Will Do The Following:\n\n1) Will Reset A Member's Medal If They Were Awarded A Honours Pass\n2) Will Remove From The Credits List\n3) Will Destroy All Files Associated With The Assignments For The Member");
		if (agree)
			return false;
		else
			return false;
	
	//}
}


/*
NCOC Class Manager Scripts
*/
function ncocClassManager_Assignments_UploadFiles(id22, assignmentName) {
	deleteCookie("NCOCCourseManualUpload", "", ".webcadets.com");
	setCookie("AssignmentName", assignmentName, '', "", "webcadets.com", 0);
	//setCookie("NCOCCourseID", id, '', "", "webcadets.com", 0);
	mywin = window.open('http://www.mywcc.webcadets.com/admin_ncoc_admin_course_students_assignments_files.php',"winUpload",'toolbar=0,location=0,directories=0,status=1,menubar=0,scrollbars=1,resizable=1,width=800,height=500,screenX=50,screenY=50,top=50,left=50');
}
function ncocClassManager_Assignments_ManualAdd(id22, assignmentName) {
	setCookie("NCOCCourseManualUpload", "true", '', "", "webcadets.com", 0);
	setCookie("AssignmentID", id22, '', "", "webcadets.com", 0);
	setCookie("AssignmentName", assignmentName, '', "", "webcadets.com", 0);
	//setCookie("NCOCCourseID", id, '', "", "webcadets.com", 0);
	mywin = window.open('http://www.mywcc.webcadets.com/admin_ncoc_admin_course_students_assignments_files.php',"winUpload",'toolbar=0,location=0,directories=0,status=1,menubar=0,scrollbars=1,resizable=1,width=800,height=500,screenX=50,screenY=50,top=50,left=50');
}
function ncocClassManager_Students(id22, coursename) {
	deleteCookie("NCOCCourseManualUpload", "", ".webcadets.com");
	setCookie("NCOCCourseID", id22, '', "", "webcadets.com", 0);
	setCookie("CourseName", coursename, '', "", "webcadets.com", 0);
	mywin = window.open('http://www.mywcc.webcadets.com/admin_ncoc_classmanager_students.php',"win",'toolbar=0,location=0,directories=0,status=1,menubar=0,scrollbars=1,resizable=1,width=800,height=500,screenX=50,screenY=50,top=50,left=50');
}
function ncocClassManager_Settings(id22, coursename) {
	deleteCookie("NCOCCourseManualUpload", "", ".webcadets.com");
	setCookie("CourseName", coursename, '', "", "webcadets.com", 0);
	setCookie("NCOCCourseID", id22, '', "", "webcadets.com", 0);
	mywin = window.open('http://www.mywcc.webcadets.com/admin_ncoc_classmanager_settings.php',"win",'toolbar=0,location=0,directories=0,status=1,menubar=0,scrollbars=1,resizable=1,width=800,height=500,screenX=50,screenY=50,top=50,left=50');
}
function ncocClassManager_Assignments(id22, coursename) {
	deleteCookie("NCOCCourseManualUpload", "", ".webcadets.com");
	setCookie("CourseName", coursename, '', "", "webcadets.com", 0);
	setCookie("NCOCCourseID", id22, '', "", "webcadets.com", 0);
	mywin = window.open('http://www.mywcc.webcadets.com/admin_ncoc_classmanager_assignments.php',"win",'toolbar=0,location=0,directories=0,status=1,menubar=0,scrollbars=1,resizable=1,width=800,height=500,screenX=50,screenY=50,top=50,left=50');
}

function ncocClassManager_StudentsAssignments(id22, memberid) {
	deleteCookie("NCOCCourseManualUpload", "", ".webcadets.com");
	setCookie("NCOCCourseStudentID", id22, '', "", "webcadets.com", 0);
	setCookie("StudentID", id22, "", "", "webcadets.com", 0);
	setCookie("MemberID", memberid, "", "", "webcadets.com", 0);
	mywinStudent = window.open('http://www.mywcc.webcadets.com/admin_ncoc_classmanager_students_assignments.php',"winStudent",'toolbar=0,location=0,directories=0,status=1,menubar=0,scrollbars=1,resizable=1,width=800,height=500,screenX=50,screenY=50,top=50,left=50');
}

/* End NCOC Class Manager Scripts */
function checkSize(form22, size) {
	numRows = 0;
	numRows = (form22.value.length / size) + 1;
	form22.rows = numRows;
}
function printPage() {
  if (window.print)
    window.print();
  else
    alert("Sorry, your browser doesn't support this feature.");
}

function changeImageBrowserDir(folderlocation) {
	setCookie("BrowserCurrentDirectory", folderlocation, '', "", "webcadets.com", 0);
	document.location = "http://www.images.webcadets.com/index.php";
}
function changeBrowserDir(folderlocation) {
	setCookie("BrowserCurrentDirectory", folderlocation, '', "", "webcadets.com", 0);
	document.location = "http://www.mywcc.webcadets.com/user_storage.php";
}
function setMainBrowserDir(folderlocation) {
	setCookie("MainDirectory", folderlocation, '', "", "webcadets.com", 0);
	setCookie("BrowserCurrentDirectory", folderlocation, '', "", "webcadets.com", 0);
	document.location = "http://www.mywcc.webcadets.com/user_storage.php";
}
function persStorageFileRename(filelocation, filenamee, functionn, LocationOnDomain) {
	setCookie("FileName", filenamee, '', "", "webcadets.com", 0);
	setCookie("FileLocation", filelocation, '', "", "webcadets.com", 0);
	setCookie("FileFunction", functionn, '', "", "webcadets.com", 0);
	setCookie("LocationOnDomain", LocationOnDomain, '', "", "webcadets.com", 0);
	var mywin = window.open("http://www.mywcc.webcadets.com/user_storage_edit.php","win",'toolbar=0,location=0,directories=0,status=1,menubar=0,scrollbars=1,resizable=0,width=700,height=500,screenX=50,screenY=50,top=50,left=50');
	mywin.focus();
}
function downloadDir(directory, name22) {
	var mywin2 = document.location = "http://www.mywcc.webcadets.com/admin_site_management_files_getfile.php?download=y&directory=" + directory + "&name="+name22;
}

////////////////////// C O O K I E   C U T T I N G ///////////////////////
// name - name of the cookie
// value - value of the cookie
// [expires] - expiration date of the cookie (defaults to end of current session)
// [path] - path for which the cookie is valid (defaults to path of calling document)
// [domain] - domain for which the cookie is valid (defaults to domain of calling document)
// [secure] - Boolean value indicating if the cookie transmission requires a secure transmission
// * an argument defaults when it is assigned null as a placeholder
// * a null placeholder is not required for trailing omitted arguments
// example) setCookie('Nav1','',null,'/')
function setCookie(namee, valuee, expiress, path, domainn, secure) {
  var curCookie = namee + "=" + escape(valuee) +
                  ((expiress) ? "; expires=" + expiress.toGMTString() : "") +
                  ((path) ? "; path=" + path : "") +
                  ((domainn) ? "; domain=" + domainn : "") +
                  ((secure) ? "; secure" : "");
  document.cookie = curCookie;
}

// name - name of the desired cookie
// * return string containing value of specified cookie or null if cookie does not exist
// example) getCookie('Nav1')
function getCookie(namee) {
  var dc = document.cookie;
  var prefix = namee + "=";
  var begin = dc.indexOf("; " + prefix);
  if (begin == -1) {
    begin = dc.indexOf(prefix);
    if (begin != 0)
		return null;
  } else
    begin += 2;
  var end = document.cookie.indexOf(";", begin);
  if (end == -1)
    end = dc.length;
  pattern = /\++/g;  // globally look for 1 or more '+'
  dc = dc.replace(pattern," ");  // replace all '+' with ' '
  return unescape(dc.substring(begin + prefix.length, end));
}

// name - name of the cookie
// [path] - path of the cookie (must be same as path used to create cookie)
// [domain] - domain of the cookie (must be same as domain used to create cookie)
// * path and domain default if assigned null or omitted if no explicit argument proceeds
function deleteCookie(namee, path, domainn) {
  if (getCookie(namee)) {
    document.cookie = namee + "=" +
                      ((path) ? "; path=" + path : "") +
                      ((domainn) ? "; domain=" + domainn : "") +
                      "; expires=Fri, 31 Dec 1999";
  }
}

//-->

var x,y,zInterval;
document.onmousemove = setMouseCoords;

function setMouseCoords(e) {
	if(document.all) {
		x = window.event.clientX;
		y = window.event.clientY;
	} else {
		x = e.pageX;
		y = e.pageY;
	}
}

function alert_sessiontime(time, sessionlimit) {
	alert ("You Will Be Automatically Logged Out On: " + time + "\nAfter " + sessionlimit + " of Inactivity");
}
function fm_setDomain(domainName) {
	setCookie("FMDomainName", domainName, '', "", ".webcadets.com", 0);
	document.location = "http://www.mywcc.webcadets.com/admin_site_filemanager.php";
}
function fm_unSetDomain() {
	deleteCookie("FMDomainName", "", ".webcadets.com");
	document.location = "http://www.mywcc.webcadets.com/admin_site_filemanager.php";
}
function fm_setFolder(folderLocation, folderName) {
	setCookie("FMFolderLocation", folderLocation, '', "", ".webcadets.com", 0);
	setCookie("FMFolderName", folderName, '', "", ".webcadets.com", 0);
	document.location = "http://www.mywcc.webcadets.com/admin_site_filemanager.php";
}
function fm_folderOptions(folderLocation, folderName, folderOption) {
	setCookie("FMCurrentDirectory", folderLocation, '', "", ".webcadets.com", 0);
	setCookie("FMFolderEditName", folderName, '', "", ".webcadets.com", 0);
	setCookie("FMFolderOption", folderOption, '', "", ".webcadets.com", 0);
	deleteCookie("FMFileEditName", "", ".webcadets.com");
	deleteCookie("FMFileOption", "", ".webcadets.com");
	if (folderOption == "Edit") {
		var mywin = window.open("http://www.mywcc.webcadets.com/admin_site_management_files_getfile.php?download=y","win",'toolbar=0,location=0,directories=0,status=1,menubar=0,scrollbars=1,resizable=0,width=700,height=500,screenX=50,screenY=50,top=50,left=50');
	}else {
		var mywin = window.open("http://www.mywcc.webcadets.com/admin_site_filemanager_edit.php","win",'toolbar=0,location=0,directories=0,status=1,menubar=0,scrollbars=1,resizable=0,width=700,height=500,screenX=50,screenY=50,top=50,left=50');
	}
	mywin.focus();
}
function fm_fileOptions(folderLocation, folderName, folderOption) {
	setCookie("FMCurrentDirectory", folderLocation, '', "", ".webcadets.com", 0);
	setCookie("FMFileEditName", folderName, '', "", ".webcadets.com", 0);
	setCookie("FMFileOption", folderOption, '', "", ".webcadets.com", 0);
	deleteCookie("FMFolderOption", "", ".webcadets.com");
	deleteCookie("FMFolderEditName", "", ".webcadets.com");
	if (folderOption == "Edit") {
		var width = getScreenSize('width');
		var height = getScreenSize('height');
		var mywin = window.open("http://www.mywcc.webcadets.com/admin_site_management_files_edit.php","win",'toolbar=0,location=0,directories=0,status=1,menubar=0,scrollbars=1,resizable=0,width='+width+',height='+height+',screenX=0,screenY=0,top=0,left=0');
	}else {
		var mywin = window.open("http://www.mywcc.webcadets.com/admin_site_filemanager_edit.php","win",'toolbar=0,location=0,directories=0,status=1,menubar=0,scrollbars=1,resizable=0,width=700,height=500,screenX=50,screenY=50,top=50,left=50');
	}
	mywin.focus();
}
function renameFile(filelocation, filenamee, functionn, LocationOnDomain) {
	setCookie("FileName", filenamee, '', "", "webcadets.com", 0);
	setCookie("FileLocation", filelocation, '', "", "webcadets.com", 0);
	setCookie("FileFunction", functionn, '', "", "webcadets.com", 0);
	setCookie("LocationOnDomain", LocationOnDomain, '', "", "webcadets.com", 0);
	var mywin = window.open("http://www.mywcc.webcadets.com/admin_site_management_files_rename.php","win",'toolbar=0,location=0,directories=0,status=1,menubar=0,scrollbars=1,resizable=0,width=700,height=500,screenX=50,screenY=50,top=50,left=50');
	mywin.focus();
}
function editFile(filelocation, filenamee) {
	setCookie("FileName", filenamee, '', "", "webcadets.com", 0);
	setCookie("FileLocation", filelocation, '', "", "webcadets.com", 0);
	setCookie("FileFunction", "edit", '', "", "webcadets.com", 0);
	setCookie("LocationOnDomain", "", '', "", "webcadets.com", 0);
	var mywin = window.open("http://www.mywcc.webcadets.com/admin_site_management_files_edit.php","win",'toolbar=0,location=0,directories=0,status=1,menubar=0,scrollbars=1,resizable=0,width=800,height=600,screenX=50,screenY=50,top=50,left=50');
	mywin.focus();
}
function folderManagement(folderlocation, foldername, functionn) {
	setCookie("FileName", foldername, '', "", "webcadets.com", 0);
	setCookie("FileLocation", folderlocation, '', "", "webcadets.com", 0);
	setCookie("FileFunction", functionn, '', "", "webcadets.com", 0);
	var mywin = window.open("http://www.mywcc.webcadets.com/admin_site_management_files_rename.php","win",'toolbar=0,location=0,directories=0,status=1,menubar=0,scrollbars=1,resizable=0,width=700,height=500,screenX=50,screenY=50,top=50,left=50');
	mywin.focus();
}
function changeDir(folderlocation) {
	setCookie("CurrentDirectory", folderlocation, '', "", "webcadets.com", 0);
	document.location = "http://www.mywcc.webcadets.com/admin_site_management_files.php";
}
function setDir(folderlocation) {
	setCookie("CurrentDirectory2", folderlocation + '', '', "", "webcadets.com", 0);
	setCookie("CurrentDirectory", '', '', "", "webcadets.com", 0);
	setCookie("CurrentDomain", folderlocation, '', "", "webcadets.com", 0);
	document.location = "http://www.mywcc.webcadets.com/admin_site_management_files.php";
}
function createDir(folderlocation, functionn) {
	setCookie("CreateDirDirectory", folderlocation, '', "", "webcadets.com", 0);
	setCookie("FileFunction", functionn, '', "", "webcadets.com", 0);
	var mywin = window.open("http://www.mywcc.webcadets.com/admin_site_management_files_rename.php","win",'toolbar=0,location=0,directories=0,status=1,menubar=0,scrollbars=1,resizable=0,width=700,height=500,screenX=50,screenY=50,top=50,left=50');
	mywin.focus();
}
function uploadFile(folderlocation, functionn) {
	setCookie("UploadDir", folderlocation, '', "", "webcadets.com", 0);
	setCookie("FileFunction", functionn, '', "", "webcadets.com", 0);
	var mywin = window.open("http://www.mywcc.webcadets.com/admin_site_management_files_upload.php","win",'toolbar=0,location=0,directories=0,status=1,menubar=0,scrollbars=1,resizable=0,width=700,height=500,screenX=50,screenY=50,top=50,left=50');
	mywin.focus();
}
function viewUploadTypes() {
	var mywin2 = window.open("http://www.mywcc.webcadets.com/admin_site_management_files_uploadtypes.php","win2",'toolbar=0,location=0,directories=0,status=1,menubar=0,scrollbars=1,resizable=0,width=500,height=500,screenX=50,screenY=50,top=50,left=50');
	mywin2.focus();
}
function downloadFile(valuee) {
	var mywin2 = document.location = "http://www.mywcc.webcadets.com/admin_site_management_files_getfile.php?filename=" + valuee;
}
function downloadRegFile(valuee) {
	var mywin2 = document.location = "http://70.98.54.45:2082/frontend/xpevolution/" + valuee;
}
function getScreenSize(type22) {
  var myWidth = 0, myHeight = 0;
  if( typeof( window.innerWidth ) == 'number' ) {
    //Non-IE
    myWidth = window.innerWidth;
    myHeight = window.innerHeight;
  } else if( document.documentElement && ( document.documentElement.clientWidth || document.documentElement.clientHeight ) ) {
    //IE 6+ in 'standards compliant mode'
    myWidth = document.documentElement.clientWidth;
    myHeight = document.documentElement.clientHeight;
  } else if( document.body && ( document.body.clientWidth || document.body.clientHeight ) ) {
    //IE 4 compatible
    myWidth = document.body.clientWidth;
    myHeight = document.body.clientHeight;
  }
  if (type22 == "width") {
	  return myWidth;
  }else {
	  return myHeight;
  }
  //window.alert( 'Height = ' + myHeight );
}
function cookieTest() {
	setCookie("Test", "Test" + '', '', "", "webcadets.com", 0);
	if (getCookie("Test")!="Test") {
	  alert('Please Make Sure Your Computer Is Able To Set Cookies.\nThank-you\nWebcadets.com');
	}else {
	}
	deleteCookie("Test","","webcadets.com");
}
function changeTextRows(thiss, temp) {
    if (temp == 'heightincrease') {
		e = document.getElementById(thiss).style.height;
		e = parseInt(e.replace("px",""));
		e += 30;
		document.getElementById(thiss).style.height = e + "px"; 
	}else if (temp == 'heightdecrease') {
		e = document.getElementById(thiss).style.height;
		e = parseInt(e.replace("px",""));
		e -= 30;
		document.getElementById(thiss).style.height = e + "px"; 
	}else if (temp == 'widthdecrease') {
		e = document.getElementById(thiss).style.width;
		e = parseInt(e.replace("px",""));
		e -= 30;
		document.getElementById(thiss).style.width = e + "px"; 
	}else if (temp == 'widthincrease') {
		e = document.getElementById(thiss).style.width;
		e = parseInt(e.replace("px",""));
		e += 30;
		document.getElementById(thiss).style.width = e + "px"; 
	}
}