function SetFocus() {
  if (document.forms.length > 0) {
    var field = document.forms[0];
    for (i=0; i<field.length; i++) {
      if ( (field.elements[i].type != "image") &&
           (field.elements[i].type != "hidden") &&
           (field.elements[i].type != "reset") &&
           (field.elements[i].type != "submit") ) {

        document.forms[0].elements[i].focus();

        if ( (field.elements[i].type == "text") ||
             (field.elements[i].type == "password") )
          document.forms[0].elements[i].select();

        break;
      }
    }
  }
}

function rowOverEffect(object) {
  if (object.className == 'dataTableRow') object.className = 'dataTableRowOver';
  if (object.className == 'readMsg') object.className = 'readMsgOver';
  if (object.className == 'unreadMsg') object.className = 'unreadMsgOver';
  if (object.className == 'dataTableCell') object.className = 'dataTableCellOver';
  if (object.className == 'mailOut') object.className = 'mailOver';
  if (object.className == 'escOut') object.className = 'escOver';
  if (object.className == 'adminOut') object.className = 'adminOver';
}

function rowOutEffect(object) {
  if (object.className == 'dataTableRowOver') object.className = 'dataTableRow';
  if (object.className == 'readMsgOver') object.className = 'readMsg';
  if (object.className == 'unreadMsgOver') object.className = 'unreadMsg';
  if (object.className == 'dataTableCellOver') object.className = 'dataTableCell';
  if (object.className == 'mailOver') object.className = 'mailOut';
  if (object.className == 'escOver') object.className = 'escOut';
  if (object.className == 'adminOver') object.className = 'adminOut';
}

function cellOverEffect(object) {
}

function cellOutEffect(object) {
}


var newWin = null;
function openWin(strURL, strType, strHeight, strWidth) {
 if (newWin != null && !newWin.closed)
   newWin.close();
 var strOptions="";
 if (strType=="strict")
   strOptions="resizable=0,location=0,menubar=0,scrollbars=0,status=0,toolbar=0,height="+
     strHeight+",width="+strWidth;
 if (strType=="console")
   strOptions="resizable,height="+
     strHeight+",width="+strWidth;
 if (strType=="fixed")
   strOptions="status,height="+
     strHeight+",width="+strWidth;
 if (strType=="elastic")
   strOptions="toolbar,menubar,scrollbars,"+
     "resizable,location,height="+
     strHeight+",width="+strWidth;
 newWin = window.open(strURL, 'newWin', strOptions);
 newWin.focus();
}


function sh_this() {
   if (arguments.length > 1) {
    	for (var a = 1; a < arguments.length; a++) {
		    document.getElementById(arguments[a]).style.display = 'none';
    	}
	}
	if (arguments[0] == 'noshow') {
		document.getElementById(arguments[0]).style.display = 'none';
	} else {
		document.getElementById(arguments[0]).style.display = 'block';
	}
}
/***********************************************
* Switch Content script II- © Dynamic Drive (www.dynamicdrive.com)
* This notice must stay intact for legal use. Last updated April 2nd, 2005.
* Visit http://www.dynamicdrive.com/ for full source code
***********************************************/

var enablepersist="off" //Enable saving state of content structure using session cookies? (on/off)
var memoryduration="7" //persistence in # of days

var contractsymbol='images/icons/minus.gif' //Path to image to represent contract state.
var expandsymbol='images/icons/plus.gif' //Path to image to represent expand state.
var collapseprevious=1 //Set to 1 to collapse previous, 0 for previously opened items to remain open.
/////No need to edit beyond here //////////////////////////

function getElementbyClass(rootobj, classname){
var temparray=new Array()
var inc=0
var rootlength=rootobj.length
for (i=0; i<rootlength; i++){
if (rootobj[i].className==classname)
temparray[inc++]=rootobj[i]
}
return temparray
}

function sweeptoggle(ec){
var inc=0
while (ccollect[inc]){
if (typeof cid=='undefined'||!(ccollect[inc].id==cid))
ccollect[inc].style.display=(ec=="contract")? "none" : ""
inc++
}
revivestatus()
}


function expandcontent(curobj, cid){
if (collapseprevious && document.getElementById(cid).style.display=="none") {
sweeptoggle('contract', cid)
}
if (ccollect.length>0){
document.getElementById(cid).style.display=(document.getElementById(cid).style.display!="none")? "none" : ""
curobj.src=(document.getElementById(cid).style.display=="none")? expandsymbol : contractsymbol
}
}

function revivecontent(){
selectedItem=getselectedItem()
selectedComponents=selectedItem.split("|")
for (i=0; i<selectedComponents.length-1; i++)
document.getElementById(selectedComponents[i]).style.display="none"
}

function revivestatus(){
var inc=0
while (statecollect[inc]){
if (ccollect[inc].style.display=="none")
statecollect[inc].src=expandsymbol
else
statecollect[inc].src=contractsymbol
inc++
}
}

function get_cookie(Name) {
var search = Name + "="
var returnvalue = "";
if (document.cookie.length > 0) {
offset = document.cookie.indexOf(search)
if (offset != -1) {
offset += search.length
end = document.cookie.indexOf(";", offset);
if (end == -1) end = document.cookie.length;
returnvalue=unescape(document.cookie.substring(offset, end))
}
}
return returnvalue;
}

function getselectedItem(){
if (get_cookie(window.location.pathname) != ""){
selectedItem=get_cookie(window.location.pathname)
return selectedItem
}
else
return ""
}

function saveswitchstate(){
var inc=0, selectedItem=""
while (ccollect[inc]){
if (ccollect[inc].style.display=="none")
selectedItem+=ccollect[inc].id+"|"
inc++
}
if (get_cookie(window.location.pathname)!=selectedItem){ //only update cookie if current states differ from cookie's
var expireDate = new Date()
expireDate.setDate(expireDate.getDate()+parseInt(memoryduration))
document.cookie = window.location.pathname+"="+selectedItem+";path=/;expires=" + expireDate.toGMTString()
}
}

function do_onload(){
uniqueidn=window.location.pathname+"firsttimeload"
var alltags=document.all? document.all : document.getElementsByTagName("*")
ccollect=getElementbyClass(alltags, "switchcontent")
statecollect=getElementbyClass(alltags, "showstate")
sweeptoggle('contract')
if (enablepersist=="on" && get_cookie(window.location.pathname)!="" && ccollect.length>0)
revivecontent()
if (ccollect.length>0 && statecollect.length>0)
revivestatus()
}

if (window.addEventListener)
window.addEventListener("load", do_onload, false)
else if (window.attachEvent)
window.attachEvent("onload", do_onload)
else if (document.getElementById)
window.onload=do_onload

if (enablepersist=="on" && document.getElementById)
window.onunload=saveswitchstate

// text select disabler

function disableSelection(target){
if (typeof target.onselectstart!="undefined") //IE route
	target.onselectstart=function(){return false}
else if (typeof target.style.MozUserSelect!="undefined") //Firefox route
	target.style.MozUserSelect="none"
else //All other route (ie: Opera)
	target.onmousedown=function(){return false}
target.style.cursor = "default"
}

//Sample usages
//disableSelection(document.body) //Disable text selection on entire body
//disableSelection(document.getElementById("mydiv")) //Disable text selection on element with id="mydiv"

// text selection disabler end

// select all code ver 1
var checkflag = "false";
function check_box(field) {
	if (checkflag == "false") {
	  for (i = 0; i < field.length; i++) {
	  	field[i].checked = true;
	  }
	  checkflag = "true";
	  return "Uncheck all";
	}
	else {
	  for (i = 0; i < field.length; i++) {
	  	field[i].checked = false;
	  }
	  checkflag = "false";
	  return "Check all";
	}
}
// select all code ver 1 end

function checkEvent (thisCheck, yesCheck, noCheck) {
	if (document.getElementById(thisCheck).value == 1) {
		document.getElementById(yesCheck).style.display = 'none';
		document.getElementById(noCheck).style.display = 'block';
	} else if (document.getElementById(thisCheck).value != 1) {
		document.getElementById(yesCheck).style.display = 'block';
		document.getElementById(noCheck).style.display = 'none';
	}
}