function setStyle(objElement,strAttribute,strValue)
{
    if (objElement == null) return false;
    objElement.style[strAttribute] = strValue;
    return true;
}

// Input values:
// name - name of the cookie
// value - value of the cookie
// [expires] - expiration date of the cookie (defaults to end of current session)
// [path] - path for which the cookie is valid (defaults to path of calling document)
// [domain] - domain for which the cookie is valid (defaults to domain of calling document)
// [secure] - Boolean value indicating if the cookie transmission requires a secure transmission
// * an argument defaults when it is assigned null as a placeholder
// * a null placeholder is not required for trailing omitted arguments
function setCookie(name, value, expires, path, domain, secure) {
  // Check whether cookies enabled
  document.cookie = "Enabled=true";
  var cookieValid = document.cookie;

  // if retrieving the VALUE we just set actually works
  // then we know cookies enabled
  if (cookieValid.indexOf("Enabled=true") != -1) {
    var curCookie = name + "=" + escape(value) +
        ((expires) ? "; expires=" + expires.toGMTString() : "") +
        ((path) ? "; path=" + path : "") +
        ((domain) ? "; domain=" + domain : "") +
        ((secure) ? "; secure" : "");

    document.cookie = curCookie;
    return(true);
  }
  else {
    return(false);
  }
}

// Input value:
// name - name of the desired cookie
// * return string containing value of specified cookie or null if cookie does not exist
function getCookie(name) {
  var dc = document.cookie;
  var prefix = name + "=";
  var begin = dc.indexOf("; " + prefix);
  if (begin == -1) {
    begin = dc.indexOf(prefix);
    if (begin != 0) return null;
  } else
    begin += 2;
  var end = document.cookie.indexOf(";", begin);
  if (end == -1)
    end = dc.length;
  return unescape(dc.substring(begin + prefix.length, end));
}

// Input values:
// name - name of the cookie
// [path] - path of the cookie (must be same as path used to create cookie)
// [domain] - domain of the cookie (must be same as domain used to create cookie)
// * path and domain default if assigned null or omitted if no explicit argument proceeds
function deleteCookie(name, path, domain) {
  if (getCookie(name)) {
    document.cookie = name + "=" + 
    ((path) ? "; path=" + path : "") +
    ((domain) ? "; domain=" + domain : "") +
    "; expires=Thu, 01-Jan-70 00:00:01 GMT";
  }
}


//ddGeo.js
		var DDSPEED = 5;
		var DDTIMER = 15;

		// main function to handle the mouse events //
		function ddMenu(id,d){
		  var h = document.getElementById(id + '_ddheader');
		  var c = document.getElementById(id + '_ddcontent');
		  clearInterval(c.timer);
		  if(d == 1){
			clearTimeout(h.timer);
			if(c.maxh && c.maxh <= c.offsetHeight){return}
			else if(!c.maxh){
			  c.style.display = 'block';
			  c.style.height = 'auto';
			  c.maxh = c.offsetHeight;
			  c.style.height = '0px';
			}
			c.timer = setInterval(function(){ddSlide(c,1)},DDTIMER);
		  }else{
			h.timer = setTimeout(function(){ddCollapse(c)},50);
		  }
		}

		// collapse the menu //
		function ddCollapse(c){
		  c.timer = setInterval(function(){ddSlide(c,-1)},DDTIMER);
		}

		// cancel the collapse if a user rolls over the dropdown //
		function cancelHide(id){
		  var h = document.getElementById(id + '_ddheader');
		  var c = document.getElementById(id + '_ddcontent');
		  clearTimeout(h.timer);
		  clearInterval(c.timer);
		  if(c.offsetHeight < c.maxh){
			c.timer = setInterval(function(){ddSlide(c,1)},DDTIMER);
		  }
		}

		// incrementally expand/contract the dropdown and change the opacity //
		function ddSlide(c,d){
		  var currh = c.offsetHeight;
		  var dist;
		  if(d == 1){
			dist = (Math.round((c.maxh - currh) / DDSPEED));
		  }else{
			dist = (Math.round(currh / DDSPEED));
		  }
		  if(dist <= 1 && d == 1){
			dist = 1;
		  }
		  c.style.height = currh + (dist * d) + 'px';
		  c.style.opacity = currh / c.maxh;
		  c.style.filter = 'alpha(opacity=' + (currh * 100 / c.maxh) + ')';
		  if((currh < 2 && d != 1) || (currh > (c.maxh - 2) && d == 1)){
			clearInterval(c.timer);
		  }
		}
	
	

//domUtils.js	
	
var isNav4, isNav6, isIE4;


function setBrowser()
{
    if (navigator.appVersion.charAt(0) == "4")
    {
        if (navigator.appName.indexOf("Explorer") >= 0)
        {
            isIE4 = true;
        }
        else
        {
            isNav4 = true;
        }
    }
    else if (navigator.appVersion.charAt(0) > "4")
    {
        isNav6 = true;
    }
}


function getStyleBySelector( selector )
{
    if (!isNav6)
    {
        return null;
    }
    var sheetList = document.styleSheets;
    var ruleList;
    var i, j;

    
    for (i=sheetList.length-1; i >= 0; i--)
    {
        ruleList = sheetList[i].cssRules;
        for (j=0; j<ruleList.length; j++)
        {
            if (ruleList[j].type == CSSRule.STYLE_RULE &&
                ruleList[j].selectorText == selector)
            {
                return ruleList[j].style;
            }   
        }
    }
    return null;
}


function getIdProperty( id, property )
{
    if (isNav6)
    {
        var styleObject = document.getElementById( id );
        if (styleObject != null)
        {
            styleObject = styleObject.style;
            if (styleObject[property])
            {
                return styleObject[ property ];
            }
        }
        styleObject = getStyleBySelector( "#" + id );
        return (styleObject != null) ?
            styleObject[property] :
            null;
    }
    else if (isNav4)
    {
        return document[id][property];
    }
    else
    {
        return document.all[id].style[property];
    }
}


function setIdProperty( id, property, value )
{
    if (isNav6)
    {
        var styleObject = document.getElementById( id );
        if (styleObject != null)
        {
            styleObject = styleObject.style;
            styleObject[ property ] = value;
        }
        
    }
    else if (isNav4)
    {
        document[id][property] = value;
    }
    else if (isIE4)
    {
         document.all[id].style[property] = value;
    }
}



function generic_move( id, xValue, yValue, additive )
{
    var left = getIdProperty(id, "left");
    var top = getIdProperty(id, "top");
    var leftMatch, topMatch;

    if (isNav4)
    {
        leftMatch = new Array( 0, left, "");
        topMatch = new Array( 0, top, "");
    }
    else if (isNav6 || isIE4 )
    {
        var splitexp = /([-0-9.]+)(\w+)/;
        leftMatch = splitexp.exec( left );
        topMatch = splitexp.exec( top );
        if (leftMatch == null || topMatch == null)
        {
            leftMatch = new Array(0, 0, "px");
            topMatch = new Array(0, 0, "px");
        }
    }
    left = ((additive) ? parseFloat( leftMatch[1] ) : 0) + xValue;
    top = ((additive) ? parseFloat( topMatch[1] ) : 0) + yValue;
    setIdProperty( id, "left", left + leftMatch[2] );
    setIdProperty( id, "top", top + topMatch[2] );
}


function moveIdTo( id, x, y )
{
    generic_move( id, x, y, false );
}


function moveIdBy( id, x, y)
{
    generic_move( id, x, y, true );
}


function hex( n )
{
    var hexdigits = "0123456789abcdef";
    return ( hexdigits.charAt(n >> 4) + hexdigits.charAt(n & 0x0f) );
}

 
function getBackgroundColor( id )
{
    var color;

    if (isNav4)
    {
        color = document[id].bgColor;
    }
    else if (isNav6)
    {
        var parseExp = /rgb.(\d+),(\d+),(\d+)./;
        var rgbvals;
        color = getIdProperty( id, "backgroundColor" );
        if (color)
        {
            rgbvals = parseExp.exec( color );
            if (rgbvals)
            {
                color = "#" + hex( rgbvals[1] ) + hex( rgbvals[2] ) +
                    hex( rgbvals[3] );
            }
        }
        return color;
    }
    else if (isIE4)
    {
        return document.all[id].backgroundColor;
    }
    return "";
}


function getDocument( divName )
{
    var doc;

    if (isNav4)
    {
        doc = window.document[divName].document;
    }
    else if (isNav6)
    {
        doc = document;
    }
    else if (isIE4)
    {
        doc = document;
    }
    return doc;
}






//AdminModeContaxtMenu.js
//set this variable to 1 if you wish the URLs of the highlighted menu to be displayed in the status bar
var display_url=1
var currentElement = null;

var ie5=document.all&&document.getElementById
var ns6=document.getElementById&&!document.all

if (ie5||ns6)
{
	var menuobj=null;
	var menuItem_EditText = null;
	document.onclick=hidemenuie5
}

function showmenuie5(e, url)
{
	if (currentElement != null)
		currentElement.removeAttribute("style");

	currentElement = ie5 ? e.srcElement : e.target;
	var urlTo = url;
	if (urlTo.substring(1,1) == '/')
	{
	    urlTo = urlTo.substring(1,urlTo.length);   //cut first "/"
	}
	urlTo = urlTo.substring(urlTo.lastIndexOf("/")+1,urlTo.length);

	if (menuItem_EditText != null)
	{
		menuItem_EditText.url = urlTo;
		menuItem_EditText.target = "edittextwindow";
	}

	currentElement.style.backgroundColor = "highlight";
	currentElement.style.color = "white";
	
	//Find out how close the mouse is to the corner of the window
	var rightedge=ie5? document.body.clientWidth-event.clientX : window.innerWidth-e.clientX
	var bottomedge=ie5? document.body.clientHeight-event.clientY : window.innerHeight-e.clientY

	//if the horizontal distance isn't enough to accomodate the width of the context menu
	if (rightedge<menuobj.offsetWidth)
		//move the horizontal position of the menu to the left by it's width
		menuobj.style.left=ie5? (document.documentElement.scrollLeft ? document.documentElement.scrollLeft : document.body.scrollLeft)+event.clientX-menuobj.offsetWidth + "px" : window.pageXOffset+e.clientX-menuobj.offsetWidth + "px"
	else
		//position the horizontal position of the menu where the mouse was clicked
		menuobj.style.left=ie5? (document.documentElement.scrollLeft ? document.documentElement.scrollLeft : document.body.scrollLeft)+event.clientX + "px" : window.pageXOffset+e.clientX + "px"
	
	//same concept with the vertical position
	if (bottomedge<menuobj.offsetHeight)
		menuobj.style.top=ie5? (document.documentElement.scrollTop ? document.documentElement.scrollTop : document.body.scrollTop)+event.clientY-menuobj.offsetHeight + "px" : window.pageYOffset+e.clientY-menuobj.offsetHeight + "px"
	else
		menuobj.style.top=ie5? (document.documentElement.scrollTop ? document.documentElement.scrollTop : document.body.scrollTop)+event.clientY + "px" : window.pageYOffset+e.clientY + "px"

	menuobj.style.visibility="visible";
	
	return false;
}

function hidemenuie5(e)
{
	if (menuobj != null)
		menuobj.style.visibility="hidden"
	
	if (currentElement != null)
		currentElement.removeAttribute("style");
}

function highlightie5(e)
{
	var firingobj=ie5? event.srcElement : e.target
	
	if (firingobj.className=="menuitems"||ns6&&firingobj.parentNode.className=="menuitems")
	{
		if (ns6&&firingobj.parentNode.className=="menuitems")
			firingobj=firingobj.parentNode //up one node
			
		firingobj.style.backgroundColor="highlight"
		firingobj.style.color="white"
		
		if (display_url==1)
			window.status=event.srcElement.url
	}
}

function lowlightie5(e)
{
	var firingobj=ie5? event.srcElement : e.target
	
	if (firingobj.className=="menuitems"||ns6&&firingobj.parentNode.className=="menuitems")
	{
		if (ns6&&firingobj.parentNode.className=="menuitems")
			firingobj=firingobj.parentNode //up one node
			
		firingobj.style.backgroundColor=""
		firingobj.style.color="black"
		window.status=''
	}
}

function jumptoie5(e)
{
	var firingobj=ie5? event.srcElement : e.target
	
	if (firingobj.className=="menuitems"||ns6&&firingobj.parentNode.className=="menuitems")
	{
		if (ns6&&firingobj.parentNode.className=="menuitems")
			firingobj=firingobj.parentNode
		
		if (ie5)
		{
			
			if (firingobj.getAttribute("target"))
				window.open(firingobj.getAttribute("url"),firingobj.getAttribute("target"))
			else
				window.location = firingobj.getAttribute("url")
		}
		else if (ns6)
		{
			if (firingobj.target)
				window.open(firingobj.url, firingobj.target)
			else
				window.location = firingobj.url;
		}
	}
}

//ButtonCache.js
function ButtonCache_Click(e)
{
    var src; 
    if (typeof(e) == "undefined")
        src = event.srcElement;
    else    
        src = e.target;
	src.disabled = true;
	src.aspnet_onclick();
	if (typeof(Page_IsValid) != "undefined")
	    src.disabled = Page_IsValid;
	else
	    src.disabled = true;
	    
}

function ButtonCache_InitOnClick(id)
{
	var sb = document.getElementById(id);
	sb.aspnet_onclick = sb.onclick;
	sb.onclick = ButtonCache_Click;
}

