/*:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
Breeze
:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::*/
function LaunchBreeze(id){
	id = escape(id);
	document.breezelogin.action = "http://mahernet.breezecentral.com/system/login-content/guest-login/login?account-id=14339732&next=%2F" + id + "%2F&path=%2F" + id + "%2F&set-lang=en";
	document.breezelogin.submit();
}//func \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\

/*:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
PAGING AND SORTING
:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::*/
function chgSort(p){
	with(document.vform){
		//If clicking on the same Column, Switch Direction
		if(ord.value == p){
			dir.value = (dir.value == 0)? 1:0;
		}else{ //Change Column and reset to Asc
			ord.value = p;
			dir.value = 0;
		}//if
		submit();
	}//for
	return false;
}//func \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\

function chgPaging(p){
	document.vform.cpage.value = p;
	document.vform.submit();
	return false;
}//func \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\

/*:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
VALIDATION
:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::*/
function hasValidChars(str, chars, caseSensitive){
	if(!str.length) return false;
	if(!chars.length) return false;
	
	if(!caseSensitive){
		str = str.toLowerCase();
		chars = chars.toLowerCase();
	}//if

	var cArr = str.split("");
	var len = cArr.length;
	var valid;
	for(var i=0; i<len; i++){
		if(chars.indexOf(cArr[i]) == -1) return false;
	}//for
	return true;
}//func \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\

function isEmail(str){
	str = str.toLowerCase();

	if(!hasValidChars(str, "0123456789abcdefghijklmnopqrstuvwxyz-_.@")) return false;
	
	var parts = str.split("@");
	
	if(parts.length!=2) return false;
	if(parts[0].length<1)return false;		

	var domain = parts[1].split(".");
	if(domain.length < 2) return false;
	
	var ext = String(domain.pop());

	if(ext.length<2) return false;
	
	var i = domain.length;
	while(i--){
		if(String(domain[i]).length < 1) return false;
	}//while
	
	return true;
}//func \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\

function ValidEmail(txt) {
	return new RegExp("^[\\w-\.]{3,}@[\\w|-|\.]{6,}$").test(txt);
}//if
	
/*:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
POPUP WINDOWS
:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::*/
//Open a Popup Window
function popWindow(href,w,h,wcont){
	if(w == 0) w = 800; //Default Settings
	if(h == 0) h = 630;
	var rest = (!wcont)? "toolbar=no,status=no,menubar=no,scrollbars=no,resizable=no,directories=no,location=no,fullscreen=no":"toolbar=yes,status=yes,menubar=yes,scrollbars=yes,resizable=yes,directories=yes,location=yes,fullscreen=no";
	window.open(href,"_blank","width="+ w + ",height=" + h + ",top=25,left=25," + rest);

	try{
		var test = window.open(href,"_blank","width="+ w + ",height=" + h + ",top=25,left=25," + rest);
	}catch(e){}
	if(test == undefined) alert("Unable to open window, you may have a popup blocker running.");
	
	return false;
}//func \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\

//Open a Popup Window
function popWindowCenter(href,w,h,wcont){
	if(w == undefined) w = 800; //Default Settings
	if(h == undefined) h = 630;
	if(wcont == undefined) wcont = 1;
	
	var l = (screen.width - w)/2;
	var t = (screen.height - h)/2;
	var rest = null;
	
	switch (wcont){
		case 0: // no toolbars
			rest = "toolbar=no,status=no,menubar=no,scrollbars=no,resizable=no,directories=no,location=no,fullscreen=no";
			break;
		case 1: // with toolbars
			rest = "toolbar=yes,status=yes,menubar=yes,scrollbars=yes,resizable=yes,directories=yes,location=yes,fullscreen=no";
			break;
		case 2: // print window
			rest = "toolbar=yes,status=yes,menubar=yes,scrollbars=yes,resizable=yes,directories=no,location=no,fullscreen=no";
			break;
	}//switch

	//var rest = (!wcont)? "toolbar=no,status=no,menubar=no,scrollbars=no,resizable=no,directories=no,location=no,fullscreen=no":"toolbar=yes,status=yes,menubar=yes,scrollbars=yes,resizable=yes,directories=yes,location=yes,fullscreen=no";
	
	try{
		var test = window.open(href,"_blank","width="+ w + ",height=" + h + ",top=" + t + ",left=" + l + "," + rest);
	}catch(e){}
	if(test == undefined) alert("Unable to open window, you may have a popup blocker running.");
	return false;
}//func \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\

//Open a Popup Window to max Screen Size
function popWindowMax(href,wcont){
	var w = screen.width; //Default Settings
	var h = screen.height;
	var l = 0;
	var t = 0;
	
	var rest = (!wcont)? "toolbar=no,status=no,menubar=no,scrollbars=no,resizable=no,directories=no,location=no,fullscreen=no":"toolbar=yes,status=yes,menubar=yes,scrollbars=yes,resizable=yes,directories=yes,location=yes,fullscreen=no";

	try{
		var test = window.open(href,"_blank","width="+ w + ",height=" + h + ",top=" + t + ",left=" + l + "," + rest);
	}catch(e){}
	if(test == undefined) alert("Unable to open window, you may have a popup blocker running.");

	return false;
}//func \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\

//Open a Popup Window, For Flash Use only
function popWindowSwf(href,w,h,wcont){
	if(w == 0) w = 800; //Default Settings
	if(h == 0) h = 630;
	var rest = (!wcont)? "toolbar=no,status=no,menubar=no,scrollbars=no,resizable=no,directories=no,location=no,fullscreen=no":"toolbar=yes,status=yes,menubar=yes,scrollbars=yes,resizable=yes,directories=yes,location=yes,fullscreen=no";

	try{
		var test = window.open(href,"_blank","width="+ w + ",height=" + h + ",top=25,left=25," + rest);
	}catch(e){}
	if(test == undefined) alert("Unable to open window, you may have a popup blocker running.");
}//func \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\

/*:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
TABBING
:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::*/
function getAddress(url){
	var href = document.location.href;
	if(url.substring(0,1) != "/") return href.substring(0,href.lastIndexOf("/")+1) + url;
	else return url;
}//func \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\

function gOpenTab(n,title,url){
	if(! top.Tab_Open) return;
	top.Tab_Open(n,title,getAddress(url));
}//func \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\

function gLoadTab(n,url){
	if(! top.Tab_Open) return;
	top.Tab_Open(n,"Loading...",getAddress(url));
}//func \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\

function gMainTab(title,url){
	top.Tab_Update(0,title,getAddress(url));
}//func \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\

function gRenameThisTab(title){
	if(! top.isLoaded) return;
	var n = this.name;
	n = n.substring(n.indexOf("_")+1,n.length);
	top.Tab_UpdateTitleByName(n,title);
}//func \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\

function gCloseThisTab(){
	var n = this.name;
	n = n.substring(n.indexOf("_")+1,n.length);
	top.Tab_CloseByName(n);
}//func \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\

/*:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
IMAGE ROLL OVERS
:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::*/
//Change the Image source of an Image
function RollImg(imgname,img){
	document.images[imgname].src = img.src;
}//func \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\

//Convert Array into an Image Array;
function LoadImageAry(imgAry){
   for(x=0;x < imgAry.length;x++){
	   temp = imgAry[x]; //Save FileName
	   imgAry[x] = new Image(); //Create Image in its place
	   imgAry[x].src = temp; //Load the Image
   }//next
}//func \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\

/*:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
MISC
:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::*/
//Change Row Style
function RowOver(obj,state){
	if(obj.tmpCls == undefined) obj.tmpCls = obj.className;
	obj.className = (state == 1)? "tHeader_1Bov" : obj.tmpCls;
}//func \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\

//Toggle Display
function togDisplay(id){
	var obj = document.getElementById(id);
	if(obj != undefined) obj.style.display = (obj.style.display == "")?"none":"";
}//func \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\

function pageReload(){
	document.location.reload();
	return false;
}//func \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\