
function MM_callJS(jsStr) { //v2.0
  return eval(jsStr)
}

function MM_changeProp(objName,x,theProp,theValue) { //v3.0
  var obj = MM_findObj(objName);
  if (obj && (theProp.indexOf("style.")==-1 || obj.style)) eval("obj."+theProp+"='"+theValue+"'");
}

function MM_findObj(n, d) { //v4.0
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
  if(!x && document.getElementById) x=document.getElementById(n); return x;
}

function MM_goToURL() { //v3.0
  var i, args=MM_goToURL.arguments; document.MM_returnValue = false;
  for (i=0; i<(args.length-1); i+=2) eval(args[i]+".location='"+args[i+1]+"'");
}

function MM_jumpMenu(targ,selObj,restore){ //v3.0
  eval(targ+".location='"+selObj.options[selObj.selectedIndex].value+"'");
  if (restore) selObj.selectedIndex=0;
}

function MM_openBrWindow(theURL,winName,features) { //v2.0
  window.open(theURL,winName,features);
}

function MM_preloadImages() { //v3.0
  var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
    var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
    if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}

function MM_reloadPage(init) {  //reloads the window if Nav4 resized
  if (init==true) with (navigator) {if ((appName=="Netscape")&&(parseInt(appVersion)==4)) {
    document.MM_pgW=innerWidth; document.MM_pgH=innerHeight; onresize=MM_reloadPage; }}
  else if (innerWidth!=document.MM_pgW || innerHeight!=document.MM_pgH) location.reload();
}
MM_reloadPage(true);

function MM_setTextOfLayer(objName,x,newText) { //v3.0 updated by Robert Lee with " && document.layers" for NS6 compatibility
  if ((obj=MM_findObj(objName))!=null) with (obj)
    if (navigator.appName=='Netscape' && document.layers) {document.write(unescape(newText)); document.close();}
    else innerHTML = unescape(newText);
}

function MM_showHideLayers() { //v3.0
  var i,p,v,obj,args=MM_showHideLayers.arguments;
  for (i=0; i<(args.length-2); i+=3) if ((obj=MM_findObj(args[i]))!=null) { v=args[i+2];
    if (obj.style) { obj=obj.style; v=(v=='show')?'visible':(v='hide')?'hidden':v; }
    obj.visibility=v; }
}

function SDIG_toggleDisplay(objName) { // changes style's display attribute between 'none' & 'block'
  var obj = MM_findObj(objName);
	if  (obj.style.display == 'none') obj.style.display = 'block';
	else obj.style.display = 'none';
}


function SDIGdigiClock(){
	var plush;
	var plusm;
	var pluss;
	var digiClock;
	now=new Date();
	if(now.getHours()<10){plush="0"}else plush='';
	if(now.getMinutes()<10){plusm="0"}else plusm='';
	if(now.getSeconds()<10){pluss="0"}else pluss='';
	digiClock=plush + now.getHours() + ':' + plusm + now.getMinutes() + ':' + pluss + now.getSeconds();
	document.getElementById('digiClock').innerHTML=digiClock;
	setTimeout("SDIGdigiClock()",1000)
}

function SDIGtoggleCheckboxes(idString) {
	var inputs = document.getElementsByTagName("input");
	var c = idString.length;
	for(index = 0; index < inputs.length; index++){
		if(inputs[index].id.substring(0,c) == idString){
			if(inputs[index].checked == 0) inputs[index].checked = 1;
			else if(inputs[index].checked == 1) inputs[index].checked = 0;
		}
	}
}

function SDIGcheckAllCheckboxes(idString) {
	var inputs = document.getElementsByTagName("input");
	var c = idString.length;
	for(index = 0; index < inputs.length; index++){
		if(inputs[index].id.substring(0,c) == idString){
			inputs[index].checked = 1;
		}
	}
}

function SDIGuncheckAllCheckboxes(idString) {
	var inputs = document.getElementsByTagName("input");
	var c = idString.length;
	for(index = 0; index < inputs.length; index++){
		if(inputs[index].id.substring(0,c) == idString){
			inputs[index].checked = 0;
		}
	}
}

function SDIGclearAllTextInputs(formId) {
	var form, elements, i, elm;
	form = document.getElementById ? document.getElementById(formId) : document.forms[formId]; 
	if(document.getElementsByTagName){
		elements = form.getElementsByTagName('input');
		for(i=0, elm; elm=elements.item(i++);){
			if(elm.getAttribute('type') == "text"){
				elm.value = '';
			}
		}
	}else{
		elements = form.elements;
		for(i=0, elm; elm=elements[i++];){
			if(elm.type == "text"){
				elm.value ='';
			}
		}
	}
}




function SDIGchangeSelectOptions(formName, selectName, selector){
	s=document.forms[formName][selectName];
	s.length=selectItems[selector].length;
	for(i=0;i<s.length;i++){
 		s.options[i]=new Option(selectItems[selector][i][1],selectItems[selector][i][0]);
	}
	if(s.length==1) document.forms[formName][selectName].disabled=true;
	else document.forms[formName][selectName].disabled=false;
}







/* Manipulation of CSS */

/*
// create a new stylesheet
var cssNode = document.createElement('style');
cssNode.type = 'text/css';
cssNode.rel = 'stylesheet';
cssNode.media = 'screen';
cssNode.title = 'dynamicSheet';	// Since we assigned a title we can find our new sheet just by checking the title as we loop through the stylesheets
document.getElementsByTagName("head")[0].appendChild(cssNode);
*/

function SDIGgetCssRule(ruleName, deleteFlag) {           // Return requested style obejct
   ruleName=ruleName.toLowerCase();                       // Convert test string to lower case.
   if (document.styleSheets) {                            // If browser can play with stylesheets
      for (var i=0; i<document.styleSheets.length; i++) { // For each stylesheet
         var styleSheet=document.styleSheets[i];          // Get the current Stylesheet
         var ii=0;                                        // Initialize subCounter.
         var cssRule=false;                               // Initialize cssRule. 
         do {                                             // For each rule in stylesheet
            if (styleSheet.cssRules) {                    // Browser uses cssRules?
               cssRule = styleSheet.cssRules[ii];         // Yes --Mozilla Style
            } else {                                      // Browser usses rules?
               cssRule = styleSheet.rules[ii];            // Yes IE style. 
            }                                             // End IE check.
            if (cssRule)  {                               // If we found a rule...
               if (cssRule.selectorText.toLowerCase()==ruleName) { //  match ruleName?
                  if (deleteFlag=='delete') {             // Yes.  Are we deleteing?
                     if (styleSheet.cssRules) {           // Yes, deleting...
                        styleSheet.deleteRule(ii);        // Delete rule, Moz Style
                     } else {                             // Still deleting.
                        styleSheet.removeRule(ii);        // Delete rule IE style.
                     }                                    // End IE check.
                     return true;                         // return true, class deleted.
                  } else {                                // found and not deleting.
                     return cssRule;                      // return the style object.
                  }                                       // End delete Check
               }                                          // End found rule name
            }                                             // end found cssRule
            ii++;                                         // Increment sub-counter
         } while (cssRule)                                // end While loop
      }                                                   // end For loop
   }                                                      // end styleSheet ability check
   return false;                                          // we found NOTHING!
}                                                         // end getCSSRule 

function SDIGkillCssRule(ruleName) {                      // Delete a CSS rule   
   return SDIGgetCssRule(ruleName,'delete');              // just call getCSSRule w/delete flag.
}                                                         // end killCSSRule

function SDIGaddCssRule(ruleName) {                       // Create a new css rule
   if (document.styleSheets) {                            // Can browser do styleSheets?
      if (!SDIGgetCssRule(ruleName)) {                    // if rule doesn't exist...
         if (document.styleSheets[0].addRule) {           // Browser is IE?
            document.styleSheets[0].addRule(ruleName, null,0);      // Yes, add IE style
         } else {                                         // Browser is IE?
            document.styleSheets[0].insertRule(ruleName+' { }', 0); // Yes, add Moz style.
         }                                                // End browser check
      }                                                   // End already exist check.
   }                                                      // End browser ability check.
   return SDIGgetCssRule(ruleName);                       // return rule we just created.
} 

function SDIGaddNewStyle(newStyle) {	// adds new rule to a <style> tag in document <head> (if style tag doesn't exist, it creates it first)
    var styleElement = document.getElementById('styles_js');
    if (!styleElement) {
        styleElement = document.createElement('style');
        styleElement.type = 'text/css';
        styleElement.id = 'styles_js';
        document.getElementsByTagName('head')[0].appendChild(styleElement);
    }
    styleElement.appendChild(document.createTextNode(newStyle));
}



