//Custom JavaScript Functions by Shawn Olson
//Copyright 2006
//http://www.shawnolson.net
//*******************************************

var pageID='';

function Right(str, n)
        /***
                IN: str - the string we are RIGHTing
                    n - the number of characters we want to return

                RETVAL: n characters from the right side of the string
                from: http://www.4guysfromrolla.com/webtech/vb2java.shtml
        ***/
        {
                if (n <= 0)     // Invalid bound, return blank string
                   return "";
                else if (n > String(str).length)   // Invalid bound, return
                   return str;                     // entire string
                else { // Valid bound, return appropriate substring
                   var iLen = String(str).length;
                   return String(str).substring(iLen, iLen - n);
                }
        }
        
function changecss(theClass,element,value) {
	//documentation for this script at http://www.shawnolson.net/a/503/
	 var cssRules;
	 if (document.all) {
	  cssRules = 'rules';
	 }
	 else if (document.getElementById) {
	  cssRules = 'cssRules';
	 }
	 for (var S = 0; S < document.styleSheets.length; S++){
	  for (var R = 0; R < document.styleSheets[S][cssRules].length; R++) {
	   if (document.styleSheets[S][cssRules][R].selectorText == theClass) {
	    document.styleSheets[S][cssRules][R].style[element] = value;
	   }
	  }
	 }	
	}
	
	function checkUncheckAll(theElement) {
     var theForm = theElement.form, z = 0;
	 for(z=0; z<theForm.length;z++){
      if(theForm[z].type == 'checkbox' && theForm[z].name != 'checkall'){
	  theForm[z].checked = theElement.checked;
	  }
     }
    }


	// *** CROSS-BROWSER COMPATIBILITY ***
	var isDOM = (document.getElementById ? true : false);
	var isIE4 = ((document.all && !isDOM) ? true : false);
	var isNS4 = (document.layers ? true : false);
	var isDyn = (isDOM || isIE4 || isNS4);

	function obj(id)
	{
	 if (isDOM) return document.getElementById(id);
	 if (isIE4) return document.all[id];
	 if (isNS4) return document.layers[id];
	}

	function objStyle(id)
	{
	 return (isNS4 ? obj(id) : obj(id).style);
	}
	// *** END CROSS-BROWSER COMPATIBILITY ***


function createRequestObject() {
    var ro;
    var browser = navigator.appName;
    if(browser == "Microsoft Internet Explorer"){
        ro = new ActiveXObject("Microsoft.XMLHTTP");
    }else{
        ro = new XMLHttpRequest();
    }
    return ro;
}

function csLink(x,divNum) {
	
	if(x=="on") {
	setIdProperty("lnk" + divNum, "background", "#AB540C");
	setIdProperty("lnk" + divNum, "color", "#FFF");
	}
	
		subID="s" + divNum
		alreadyOn=getIdProperty(subID,"display")
		
		if(x=="off" && alreadyOn=='none') {
		setIdProperty("lnk" + divNum, "background", "#4B5A59");
		setIdProperty("lnk" + divNum, "color", "#FFF");
		}
}

function plantLink(id) {
	eval("document.getElementById('" + id + "').style.fontWeight='bold'");
}

function displaySublink(divNum)
{
	if (getIdProperty("s" + divNum, "display") == "none" ||
			getIdProperty("s" + divNum, "display") == null)
	{
		setIdProperty("s" + divNum, "display", "block");
	}
	else
	{
		setIdProperty("s" + divNum, "display", "none");
	}
}

function openDiv(id)
{
	if (getIdProperty("uc" + id, "display") == "none" ||
			getIdProperty("uc" + id, "display") == null)
	{
		setIdProperty("uc" + id, "display", "block");
		setIdProperty("user" + id, "display", "block");
	}
	else
	{
		setIdProperty("uc" + id, "display", "none");
		setIdProperty("user" + id, "display", "none");
	}
}

function getIdProperty( id, property )
{
	var styleObject = document.getElementById( id );
	if (styleObject != null)
	{
	    styleObject = styleObject.style;
	    if (styleObject[property])
	    {
	        return styleObject[ property ];
	    }
	}
}

function setIdProperty( id, property, value )
{
	var styleObject = document.getElementById( id );
	if (styleObject != null)
	{
	    styleObject = styleObject.style;
	    styleObject[ property ] = value;
	}
}
function popVideo(vn){			
	videoWin=window.open('/webbuilder/demo.asp','qzWin','width=660,height=460,left=150,top=200,screenX=150,screenY=200')
}		

