// JavaScript Document

<!--
function doNothing(){
	//
}
function IsNumeric(sText){
   var ValidChars = "0123456789.";
   var IsNumber=true;
   var Char;

   for (i = 0; i < sText.length && IsNumber == true; i++){ 
      Char = sText.charAt(i); 
      if (ValidChars.indexOf(Char) == -1){
         IsNumber = false;
      }
   }
   return IsNumber;
}

function swapImg(ImgID,ImgFile){
	window.document.getElementById(ImgID).src = ImgFile;
}

function ShowHideSectionWithPM(myID, myImageID){
	myID = document.getElementById(myID);
	myImageID = document.getElementById(myImageID);
	if (myID.style.display=="block"){
		myID.style.display="none";
		myImageID.src = "/_images/btn_Details_zoom.png";
	} else {
		myID.style.display="block";
		myImageID.src = "/_images/btn_Details_zoom_out.png";
	}
}
function Show(myID){
	myID = document.getElementById(myID);
	myID.style.display="block";
}
function Hide(myID){
	myID = document.getElementById(myID);
	myID.style.display="none";
}

function ResetField(myFormField, startinValue){
	myField = document.getElementById(myFormField);
	if (myField.value==startinValue){
		myField.value="";
	}	
}

function revertField(myFormField, startinValue){
	myField = document.getElementById(myFormField);
	if (myField.value==""){
		myField.value=startinValue;
		setCSS(myFormField, 'FormFieldActiveBeforeInput');
	}	
}
	   
	   
function clearField(myFormField){
	document.getElementById(myFormField).value = "";		
}

function clearIfStarting(myFormField,myCSS,defaultContent){
	currentContent = document.getElementById(myFormField).value;
	if (currentContent=="mm/dd/yyyy" || currentContent=="mm/yyyy" || currentContent=="mm" || currentContent=="yyyy" || currentContent=="XXX-XXX-XXXX" || currentContent==defaultContent){
		document.getElementById(myFormField).value = "";		
	}
	if(myCSS!=""){
		setCSS(myFormField, myCSS);
	}
}

function setCSS(myFormField, myClass){
	if (myFormField!="" && myClass!=""){
		document.getElementById(myFormField).className = myClass;
	}
}

function countChars(myDiv,myFormElement,MaxChars){
	myDiv = document.getElementById(myDiv);
	myCurrentFieldValue = document.getElementById(myFormElement).value;
	myAmtRemaining = MaxChars - myCurrentFieldValue.length;
	myDiv.innerHTML = "(" + myAmtRemaining + " characters left)";	
	
}

function setValueMaxChars(myFormElement,MaxLen){
	myCurrentField = document.getElementById(myFormElement);
	if (myCurrentField.value.length>MaxLen){
		document.getElementById(myFormElement).value = myCurrentFieldValue.value.substring(0, MaxLen);
	}
}

function countWithMaxChar(field, myDiv, maxlimit) {
	if (field.value.length > maxlimit){
		field.value = field.value.substring(0, maxlimit);
	} else {
		charLeft = maxlimit - field.value.length;
		myCounterDiv = document.getElementById(myDiv);
		myCounterDiv.innerHTML = "(" + charLeft + " characters left)";
	}
}

function enableFormObject(myFormField,myCSS){
	myFormField = document.getElementById(myFormField);
	if (myFormField.disabled==true){
		myFormField.disabled = false;		
		if(myCSS!=""){
			setCSS(myFormField, myCSS);
		}
	} else {
		myFormField.disabled = true;		
		if(myCSS!=""){
			setCSS(myFormField, 'FormFieldDisabled');
		}
	}
}

/* 'URL_TO_OPEN', - The address of the page to open 
400, - window width 
400, - window height 
1, - Tool Bar 1=On 0=Off 
1, - Address Bar 1=On 0=Off 
1, - Directories 1=On 0=Off 
1, - Status Bar 1=On 0=Off 
1, - Menu Bar 1=On 0=Off 
1, - Scroll Bars 1=On 0=Off 
1, - Resize 1=On 0=Off 
1, - Copy History 1=On 0=Off 
5, - Window Position 1-9 
'win1' - The window name 
Example...
open_win('URL',600,450,0,0,0,0,1,1,1,0,5,'pwName')
*/
function open_win(what_link,the_x,the_y,toolbar,addressbar,directories,statusbar,menubar,scrollbar,resize,history,pos,wname){ 
var the_url = what_link;
if (wname=='pwCapability'){
	the_x = screen.availWidth*.9;
	the_y = screen.availHeight*.9;
} else {
	the_x -= 0;
	the_y -= 0;
}
var how_wide = screen.availWidth;
var how_high = screen.availHeight;
if(toolbar == "0"){var the_toolbar = "no";}else{var the_toolbar = "yes";}
if(addressbar == "0"){var the_addressbar = "no";}else{var the_addressbar = "yes";}
if(directories == "0"){var the_directories = "no";}else{var the_directories = "yes";}
if(statusbar == "0"){var the_statusbar = "no";}else{var the_statusbar = "yes";}
if(menubar == "0"){var the_menubar = "no";}else{var the_menubar = "yes";}
if(scrollbar == "0"){var the_scrollbars = "no";}else{var the_scrollbars = "yes";}
if(resize == "0"){var the_do_resize =  "no";}else{var the_do_resize = "yes";}
if(history == "0"){var the_copy_history = "no";}else{var the_copy_history = "yes";}
if(pos == 1){top_pos=0;left_pos=0;}
if(pos == 2){top_pos = 0;left_pos = (how_wide/2) -  (the_x/2);}
if(pos == 3){top_pos = 0;left_pos = how_wide - the_x;}
if(pos == 4){top_pos = (how_high/2) -  (the_y/2);left_pos = 0;}
if(pos == 5){top_pos = (how_high/2) -  (the_y/2);left_pos = (how_wide/2) -  (the_x/2);}
if(pos == 6){top_pos = (how_high/2) -  (the_y/2);left_pos = how_wide - the_x;}
if(pos == 7){top_pos = how_high - the_y;left_pos = 0;}
if(pos == 8){top_pos = how_high - the_y;left_pos = (how_wide/2) -  (the_x/2);}
if(pos == 9){top_pos = how_high - the_y;left_pos = how_wide - the_x;}

if (window.outerWidth ) {
	var option = "toolbar="+the_toolbar+",location="+the_addressbar+",directories="+the_directories+",status="+the_statusbar+",menubar="+the_menubar+",scrollbars="+the_scrollbars+",resizable="+the_do_resize+",outerWidth="+the_x+",outerHeight="+the_y+",copyhistory="+the_copy_history+",left="+left_pos+",top="+top_pos;
	wname=window.open(the_url, wname, option);
	wname.focus();
} else {
	var option = "toolbar="+the_toolbar+",location="+the_addressbar+",directories="+the_directories+",status="+the_statusbar+",menubar="+the_menubar+",scrollbars="+the_scrollbars+",resizable="+the_do_resize+",Width="+the_x+",Height="+the_y+",copyhistory="+the_copy_history+",left="+left_pos+",top="+top_pos;
	if (!wname.closed && wname.location)
		wname.location.href=the_url;
	else {
		wname=window.open(the_url, wname, option);
		//wname.resizeTo(the_x,the_y);
		wname.focus();
		wname.location.href=the_url;
	}
}

//return wname;
} 

function css_browser_selector(u){var ua = u.toLowerCase(),is=function(t){return ua.indexOf(t)>-1;},g='gecko',w='webkit',s='safari',o='opera',h=document.documentElement,b=[(!(/opera|webtv/i.test(ua))&&/msie\s(\d)/.test(ua))?('ie ie'+RegExp.$1):is('firefox/2')?g+' ff2':is('firefox/3.5')?g+' ff3 ff3_5':is('firefox/3')?g+' ff3':is('gecko/')?g:is('opera')?o+(/version\/(\d+)/.test(ua)?' '+o+RegExp.$1:(/opera(\s|\/)(\d+)/.test(ua)?' '+o+RegExp.$2:'')):is('konqueror')?'konqueror':is('chrome')?w+' chrome':is('iron')?w+' iron':is('applewebkit/')?w+' '+s+(/version\/(\d+)/.test(ua)?' '+s+RegExp.$1:''):is('mozilla/')?g:'',is('j2me')?'mobile':is('iphone')?'iphone':is('ipod')?'ipod':is('mac')?'mac':is('darwin')?'mac':is('webtv')?'webtv':is('win')?'win':is('freebsd')?'freebsd':(is('x11')||is('linux'))?'linux':'','js']; c = b.join(' '); h.className += ' '+c; return c;}; 

css_browser_selector(navigator.userAgent);

-->

