
function changeDivText(id, text)
{
	var d = document.getElementById(id);
	d.innerHTML = text;
}

function changeDivTabText(id, text, divId, colorClassName)
{
	var d = document.getElementById(id);
	var css_bkcolor = getCssRules(colorClassName, 'background-color');
	d.innerHTML = '<div class="'+colorClassName+'">'+  text +' </div>';
	makeRoundCorner(divId, css_bkcolor);
}

function changeDivContent(divName, file, iframe)
{
	var d = document.getElementById(divName);
	d.innerHTML = '<iframe id="'+ iframe +'" src="'+file+'" frameBorder="0" scrolling="none" align="top" marginwidth="0" marginheight="0" width="100%" onLoad="resizeIframe(\''+iframe+'\');return false;"></iframe>';

}

function getBrowserHeight(){
	var h = this.outerHeight;
	return h;
}


function changeIframeContent(iframe, file, icontent)
{
	var d = document.getElementById(icontent);
	d.innerHTML = '<iframe id=\''+ iframe +'\' src="'+file+'" frameBorder="0" scrolling="none" align="top" marginwidth="0" marginheight="0" width="100%"  onLoad="resizeIframe(\''+iframe+'\');"></iframe>';
}


function resizeIframe(iframeName) {
	var d = parent.document.getElementById(iframeName);
	if (d){
		d.height= d.contentWindow.document.body.scrollHeight;
		d.parentNode.scrolling='no';
	}
}

function resizeIframe2(iframeName) {
	var d = document.getElementById(iframeName);
	if (d){
		d.height= d.contentWindow.document.body.scrollHeight;
		d.parentNode.scrolling='no';
	}
}

function resizeHeight(iframeName, h) {
	var d = document.getElementById(iframeName);
	if (d){
		d.height= h;
	}
}


function resetHeight(h) {
	alert(h);
	this.document.outerHeight= h;
}

function noScrollbar(){
	

}

function makeRoundCorner(id, color)
{
  /*
  The new 'validTags' setting is optional and allows
  you to specify other HTML elements that curvyCorners
  can attempt to round.

  The value is comma separated list of html elements
  in lowercase.

  validTags: ["div", "form"]

  The above example would enable curvyCorners on FORM elements.
  */
  settings = {
	  tl: { radius: 10 },
	  tr: { radius: 10 },
	  bl: { radius: 0 },
	  br: { radius: 0 },
	  antiAlias: true,
	  autoPad: true,
	  validTags: ["span", "div"]
	 
  }

  /*
  Usage:

  newCornersObj = new curvyCorners(settingsObj, classNameStr);
  newCornersObj = new curvyCorners(settingsObj, divObj1[, divObj2[, divObj3[, . . . [, divObjN]]]]);
  */
  var myBoxObject = new curvyCorners(settings, id, color);
  myBoxObject.applyCornersToAll();
}	

function makeRoundCornerPubkey(id, color)
{
  /*
  The new 'validTags' setting is optional and allows
  you to specify other HTML elements that curvyCorners
  can attempt to round.

  The value is comma separated list of html elements
  in lowercase.

  validTags: ["div", "form"]

  The above example would enable curvyCorners on FORM elements.
  */
  settings = {
	  tl: { radius: 10 },
	  tr: { radius: 10 },
	  bl: { radius: 10 },
	  br: { radius: 10 },
	  antiAlias: true,
	  autoPad: true,
	  validTags: ["span", "div"]
	 
  }

  /*
  Usage:

  newCornersObj = new curvyCorners(settingsObj, classNameStr);
  newCornersObj = new curvyCorners(settingsObj, divObj1[, divObj2[, divObj3[, . . . [, divObjN]]]]);
  */
  var myBoxObject = new curvyCorners(settings, id, color);
  myBoxObject.applyCornersToAll();
}			  


function getCssRules(c, property)
{
	var crLen;
	var browser=whichBrs();
	
	if (browser=='Internet Explorer'){
		crLen = document.styleSheets[0].rules.length;
	}else{
		crLen = document.styleSheets[0].cssRules.length;
	}

	if (browser=='Internet Explorer'){
		for (var i=0; i<crLen; i++){
			if (document.styleSheets[0].rules[i].selectorText=='.'+c){
				var p;
				switch (property){
					case 'background-color':
						return document.styleSheets[0].rules[i].style.backgroundColor;	
						break;
				}
				
			}
		}		
	}else{
		for (var i=0; i<crLen; i++){
			if (document.styleSheets[0].cssRules[i].selectorText=='.'+c){
				var p;
				switch (property){
					case 'background-color':
						return document.styleSheets[0].cssRules[i].style.backgroundColor;	
						break;
				}			
			}
		}
	}
}

// Browser Detection Javascript
// copyright 1 February 2003, by Stephen Chapman, Felgall Pty Ltd

// You have permission to copy and use this javascript provided that
// the content of the script is not changed in any way.

function whichBrs() {
	var agt=navigator.userAgent.toLowerCase();
	if (agt.indexOf("opera") != -1) return 'Opera';
	if (agt.indexOf("staroffice") != -1) return 'Star Office';
	if (agt.indexOf("webtv") != -1) return 'WebTV';
	if (agt.indexOf("beonex") != -1) return 'Beonex';
	if (agt.indexOf("chimera") != -1) return 'Chimera';
	if (agt.indexOf("netpositive") != -1) return 'NetPositive';
	if (agt.indexOf("phoenix") != -1) return 'Phoenix';
	if (agt.indexOf("firefox") != -1) return 'Firefox';
	if (agt.indexOf("safari") != -1) return 'Safari';
	if (agt.indexOf("skipstone") != -1) return 'SkipStone';
	if (agt.indexOf("msie") != -1) return 'Internet Explorer';
	if (agt.indexOf("netscape") != -1) return 'Netscape';
	if (agt.indexOf("mozilla/5.0") != -1) return 'Mozilla';
	if (agt.indexOf('\/') != -1) 
	{
		if (agt.substr(0,agt.indexOf('\/')) != 'mozilla') 
		{
			return navigator.userAgent.substr(0,agt.indexOf('\/'));
		}else return 'Netscape';
	}else if (agt.indexOf(' ') != -1)
		return navigator.userAgent.substr(0,agt.indexOf(' '));
	else return navigator.userAgent;
}


function menuHighlight(item, itemMax, itemNum) {
	var cNormal = '#ffffff';
	var cHighlight = '#eeeeee';
	var menuMax = itemMax;
	for (var i = 1; i <= menuMax; i++){
		var id = item + i;
		var d = document.getElementById(id);
		d.style.backgroundColor=cNormal; 
	}
	//alert(showid.contentWindow);
	var current = document.getElementById(item + itemNum);
	current.style.backgroundColor=cHighlight;
	Set_Cookie(item, itemNum);
	

}

function topMenuHighlight2(item, itemMax, itemNum) {
	var cNormal = '#ffffff';
	var cHighlight = '#eeeeee';
	var menuMax = itemMax;
	for (var i = 1; i <= menuMax; i++){
		var id = item + i;
		var d = this.top.document.getElementById(id);
		d.style.backgroundColor=cNormal; 
	}
	//alert(showid.contentWindow);
	var current = parent.document.getElementById(item + itemNum);
	current.style.backgroundColor=cHighlight;
	Set_Cookie(item, itemNum);
	

}

function topMenuHighlight(itemNum) {
	var cNormal = '#ffffff';
	var cHighlight = '#eeeeee';
	var ucHighlight = '#17405B';
	var item = 'menu';
	var uItem = 'underline';
	var menuMax = 9;
	for (var i = 1; i <= menuMax; i++){
		var id = item + i;
		var d = this.top.document.getElementById(id);
		d.style.backgroundColor=cNormal; 
		var uid = uItem + i;
		var ud = this.top.document.getElementById(uid);
		ud.style.backgroundColor=cNormal; 
	}
	//alert(showid.contentWindow);
	var current = this.top.document.getElementById(item + itemNum);
	current.style.backgroundColor=cHighlight;
	var uCurrent = this.top.document.getElementById(uItem + itemNum);
	uCurrent.style.backgroundColor=ucHighlight;
	//current.style.BorderBottomWidth=4;
	Set_Cookie(item, itemNum);
	

}



function  setVisible(div){
	var n = 'd';
	var max = 3;
	for (var i=1; i<=max; i++){
		var dname = n+i;
		var d = document.getElementById(dname);
		d.style.visiblity = false;
		d.style.display = 'none';
	}
	var nd = document.getElementById(n+div);
	nd.style.visibleity = true;
	nd.style.display = 'block';
}

function copyContent(d, s){
	var nd = document.getElementById(d);
	nd.innerHTML=document.getElementById(s).innerHTML;
	nd.parentNode.scrolling='no';
}

// Cookie Management Javascripts
function Get_Cookie(name)
{ 	var start = document.cookie.indexOf(name + "=");
	 var len = start + name.length + 1;
	 
	 if ((!start) && (name!=document.cookie.substring(0,name.length))) return null;
	 if (start==-1) return null;
	 
	 var end = document.cookie.indexOf(";", len);
	 if (end==-1) end = document.cookie.length;
	 
	 return unescape(document.cookie.substring(len,end));
}
 
function Set_Cookie(name, value)
{ var today = new Date(); // set time, it's in milliseconds
	 var expires = 365; // 1 year
	 var path = false;
	 var domain = false;
	 var secure = false;
	 
	 today.setTime(today.getTime());
	 // if the expires variable is set, make the correct expires time, the
	 // current script below will set it for x number of days
	 if (expires) expires = expires * 1000 * 60 * 60 * 24;
	 
	 //alert('today ' + today.toGMTString() );// this is for testing purpose only
	 var expires_date = new Date(today.getTime()+(expires));
	 //alert('expires ' + expires_date.toGMTString());// this is for testing purposes only
	 
	 document.cookie = name+"="+escape(value)+
	  ((expires) ? ";expires="+expires_date.toGMTString() : "")+ // expires.toGMTString()
	  ((path) ? ";path="+path : "")+
	  ((domain) ? ";domain="+domain : "")+
	  ((secure) ? ";secure" : "");
}
 
function Delete_Cookie(name, path, domain)
{
	if (Get_Cookie(name))
     document.cookie = name+"="+((path) ? ";path="+path : "")+((domain) ? ";domain="+domain : "" )+";expires=Thu, 01-Jan-2000 00:00:00 GMT";
}

function Restore_Cookie()
{
	var mc = Get_Cookie('menu');
	menuHighlight('menu', 9, mc);

}

