// Site Functions //
function CheckBoxChange(cb) {

	var frm = cb.form, i = 0;
	
	while (i < frm.length) {
	
		if (frm[i].type == 'checkbox') {
		
			frm[i].checked = cb.checked;
		
		}
		
		i++;

	}

}

function ToggleVisibility(targetId){ 

  if (document.getElementById) {
   
		target = document.getElementById( targetId ); 
		
        if (target.style.display == "none"){ 
        
			target.style.display = ""; 
			
        } else { 
        
			target.style.display = "none"; 
			
        } 
        
     } 
     
} 

function Print() {

	openWindow('../utilities/print.aspx', 580, 520, 'yes');

}

function ConfirmDelete(t) {

	return confirm('Are you sure you want to delete this ' + t + '?');

}

function detectFlash(ver) {
	
	var browserId = BrowserDefine();
	
		if (getFlashVersion() > ver && browserId == 0) {
		
			return true;
			
		} else {
		
			return false;
			
		}
		
	}
	
function getFlashVersion() {

	var flashversion = 0;
	
	if (navigator.plugins && navigator.plugins.length) {
	
		var x = navigator.plugins["Shockwave Flash"];
		
		if(x){
		
			if (x.description) {
			
				var y = x.description;
	   			flashversion = y.charAt(y.indexOf('.')-1);
	   			
			}
			
		}
		
	} else {
	
		result = false;
		
		for(var i = 15; i >= 3 && result != true; i--){
		
   			execScript('on error resume next: result = IsObject(CreateObject("ShockwaveFlash.ShockwaveFlash.'+i+'"))','VBScript');
   			flashversion = i;
   			
   		}
   		
	}
	
	return flashversion;
	
}

// Standard Functions //
function PageSend() {

	openWindow('../utilities/send.aspx?page=' + escape(this.location.href), 480, 485, 'no');
	
}
function Redirect(s) {

	window.location.href = s;
	
}
function Concat(s1, s2) {

	return s1 + s2;
	
}
function loadFrame(loc,wdt,hgt,scr){

	var browserId = BrowserDefine();
	var div = document.getElementById('div_global');
	var ifrm = document.getElementById('ifrm_global');

	div.style.width = wdt;
	div.style.top = document.documentElement.scrollTop + 30;
	div.style.left = 200;
	
	switch (browserId) {
	
		case "0":
		
			showFrame(div);
			
			ifrm.src = loc
			ifrm.style.height = hgt
			ifrm.style.width = wdt
			
			break;
			
		case "1":
	
			showFrame(div);
			
			ifrm.src = loc
			ifrm.style.height = hgt
			ifrm.style.width = wdt
			
			break;
			
		default:
		
			openWindow(loc, wdt, hgt);
			
	}
	
}
function BrowserDefine() {

	try {
	
		var browserId = navigator.appName;

		if (browserId.indexOf("Microsoft")!=-1) browserId="0";
		
		else if (browserId.indexOf("Netscape")!=-1) browserId="1";
		
		else browserId="2";
		
		return browserId;

	}
	
	catch(er) {
	
		return 2;
		
	}
	
}
function openWindow(loc,wdt,hgt,scroll) {

	var top_pos = 120;
	
	window.open(loc, 'win', 'height=' + hgt + ',width=' + wdt + ',top=' + top_pos + ',left=100' + ',toolbar=yes,scrollbars=' + scroll);

}