/*	
	KKS BOLASH Global javascript
	
	Updated on June 18, 2004

*/

/*
If you use a DOCTYPE that puts Explorer 6 in standards compliant mode, some properties 
of document.body are reassigned to document.documentElement. In Explorer 5 the 
properties still belong to document.body. Checking if the documentElement exists is not 
enough, since it exists in all W3C DOM compatible browsers, so we also have to see if 
it has the property we are trying to access.

*/

var Browser = {
	w3c : document.getElementById,
	iex : document.all,
	scrollLoop : false,    // boolean
	scrollInterval : null, // setInterval id
	currentBlock : null,   // object reference
	getWindowHeight : function(){
		if(this.iex) return (document.documentElement.clientHeight) ? document.documentElement.clientHeight : document.body.clientHeight;
		else return window.innerHeight;
	},
	getScrollLeft : function(){
		if(this.iex) return (document.documentElement.scrollLeft) ? document.documentElement.scrollLeft : document.body.scrollLeft;
		else return window.pageXOffset;
	},
	getScrollTop : function(){
		if(this.iex) return (document.documentElement.scrollTop) ? document.documentElement.scrollTop : document.body.scrollTop;
		else return window.pageYOffset;
	},
	getElementYpos : function(el){
		var y = 0;
		while(el.offsetParent){
			y += el.offsetTop
			el = el.offsetParent;
		}
		return y;
	},
	scroll : function(num){
		if(!this.w3c){
			location.href = "#"+this.anchorName+num;
			return;
		}
		if(this.scrollLoop){
			clearInterval(this.scrollInterval);
			this.scrollLoop = false;
			this.scrollInterval = null;
		}
		if(this.currentBlock != null) this.currentBlock.className = this.offClassName;
		this.currentBlock = document.getElementById(this.blockName+num);
		this.currentBlock.className = this.onClassName;
		var doc = document.getElementById(this.containerName);
		var documentHeight = this.getElementYpos(doc) + doc.offsetHeight;
		var windowHeight = this.getWindowHeight();
		var ypos = this.getElementYpos(this.currentBlock);
		if(ypos > documentHeight - windowHeight) ypos = documentHeight - windowHeight;
		this.scrollTo(0,ypos);
	},
	scrollTo : function(x,y){
		if(this.scrollLoop){
			var left = this.getScrollLeft();
			var top = this.getScrollTop();
			if(Math.abs(left-x) <= 1 && Math.abs(top-y) <= 1){
				window.scrollTo(x,y);
				clearInterval(this.scrollInterval);
				this.scrollLoop = false;
				this.scrollInterval = null;
			}else{
				window.scrollTo(left+(x-left)/2, top+(y-top)/2);
			}
		}else{
			this.scrollInterval = setInterval("Browser.scrollTo("+x+","+y+")",100);
			this.scrollLoop = true;
		}
	}
};

/*
using the following line, IE/PC returns an incorrect number when getting the document height.
var document_height = document.all ? document.body.offsetHeight : window.document.height;
To fix this problem, a container div is wrapped around the content so the correct height 
can be determined.
*/

// Edit these variables

Browser.containerName = "container"; // The id name of the div containing the content
Browser.anchorName    = "anchor";    // The alpha portion of the anchor names
Browser.blockName     = "d";     // The alpha portion of the content blocks
Browser.onClassName   = "active";    // The CSS class name for the 'on' state
Browser.offClassName  = "visited";   // The CSS class name for the 'off' state

//

function Is () 
{   // convert all characters to lowercase to simplify testing 
    var agt=navigator.userAgent.toLowerCase(); 

    // *** BROWSER VERSION *** 
    // Note: On IE5, these return 4, so use is.ie5up to detect IE5. 
    this.major = parseInt(navigator.appVersion); 
    this.minor = parseFloat(navigator.appVersion); 

    this.nav = ((agt.indexOf('mozilla')!=-1) && (agt.indexOf('spoofer')==-1) && (agt.indexOf('compatible') == -1) && (agt.indexOf('opera')==-1) && (agt.indexOf('webtv')==-1)); 
    this.nav2 = (this.nav && (this.major == 2)); 
    this.nav3 = (this.nav && (this.major == 3)); 
    this.nav4 = (this.nav && (this.major == 4)); 
    this.nav4up = (this.nav && (this.major >= 4)); 
    this.navonly = (this.nav && ((agt.indexOf(";nav") != -1) || (agt.indexOf("; nav") != -1)) ); 
    this.nav5 = (this.nav && (this.major == 5)); 
    this.nav5up = (this.nav && (this.major >= 5));

    this.ie = (agt.indexOf("msie") != -1); 
    this.ie3 = (this.ie && (this.major < 4)); 
    this.ie4 = (this.ie && (this.major == 4) && (agt.indexOf("msie 5.0")==-1) ); 
    this.ie4up = (this.ie  && (this.major >= 4)); 
    this.ie5 = (this.ie && (this.major == 4) && (agt.indexOf("msie 5.0")!=-1) ); 
    this.ie5up = (this.ie  && !this.ie3 && !this.ie4);
	
	this.opera = (agt.indexOf("opera") != -1); 

    // *** PLATFORM *** 
    this.win = ( (agt.indexOf("win")!=-1) || (agt.indexOf("16bit")!=-1) ); 
    this.mac = (agt.indexOf("mac")!=-1); 
    this.linux = (agt.indexOf("inux")!=-1); 
} 

var is = new Is();
function unblur() {
this.blur();
}

// remove IE's nasty habit of highlighting borders
// ----------------------------------------------
function blurLinks() {
		if (!document.getElementById) return;
		theLinks = document.getElementsByTagName("a");
		for(i=0; i<theLinks.length; i++) {
			theLinks[i].onfocus = unblur;
		}
		theMaps = document.getElementsByTagName("area");
		for(i=0; i<theMaps.length; i++) {
			theMaps[i].onfocus = unblur;
		}
	}

// preload images
// ----------------------------------------------
function preloadImages()
{ 
  var args = preloadImages.arguments;
  document.imageArray = new Array(args.length);
  for(var i=0; i<args.length; i++)
  {
    document.imageArray[i] = new Image;
    document.imageArray[i].src = args[i];
  }
}

// switch images
// ----------------------------------------------
function switchImage(imgName,imgSrc) 
{
  if (document.images)
  {
    if (imgSrc != "none")
    {
      document.images[imgName].src = imgSrc;
    }
  }
}
// protect email addresses from spambots
// ----------------------------------------------
function SpamShield(user,domain) {
	locationstring = "mailto:" + user + "@" + domain;
	window.location = locationstring;
	}

// show/hide layers
// ----------------------------------------------
function showLayer(layerName, shadowLayerName)
	{
	if (document.getElementById) // Netscape 6 and IE 5+
		{
 			var targetElement = document.getElementById(layerName);
			targetElement.style.visibility = 'visible';
            }
        }

function hideLayer(layerName)
	{
		if (document.getElementById) 
            {
			var targetElement = document.getElementById(layerName);
			targetElement.style.visibility = 'hidden';
            }
        }


function openWindow(mypage,myname, w, h){
  var win= null;
  var winl = (screen.width-w)/2;
  var wint = (screen.height-h)/2;
  var settings  ='height='+h+',';
      settings +='width='+w+',';
      settings +='top='+wint+',';
      settings +='left='+winl+',';
      
  win=window.open(mypage,myname,settings);
  if(parseInt(navigator.appVersion) >= 4){win.window.focus();}
}


function openWebCast(mypage,myname){
  var win= null;
  var w = 600;
  var h = 620;
  var winl = (screen.width-w)/2;
  var wint = (screen.height-h)/2;
  var settings  ='height='+h+',';
      settings +='width='+w+',';
      settings +='top='+wint+',';
      settings +='left='+winl+',';
  win=window.open(mypage,myname,settings);
  if (parseInt(navigator.appVersion) >= 4)
  {
  win.window.focus();
  }

}



function launchwin()
{
      newwin = window.open("display.aspx","view","fullscreen=1, scrollbars=1")
      newwin.resizeBy(15,0)
}

function getWindow(what, w, h) {
  var winl = (screen.width-w)/2;
  var wint = (screen.height-h)/2;
  var settings  ='status=no,resizable=yes,scrollbars=yes,height='+h+',';
      settings +='width='+w+',';
      settings +='top='+wint+',';
      settings +='left='+winl+',';
  win=window.open(what,what,settings);
  if(parseInt(navigator.appVersion) >= 4){win.window.focus();}
}


function getTeeter(what) {
  var winl = screen.width/2;
  var wint = (screen.height - 800)/2;
  
  var settings  = 'status=no,resizable=yes,scrollbars=yes,height=625,';
      settings += 'width=' 	+ screen.width + ',';
      settings += 'top= '	+wint+',';
      settings += 'left='	+winl+',';
  win=window.open(what,'TEETER',settings);
  if(parseInt(navigator.appVersion) >= 4){win.window.focus();}
}



function openScrollWindow(mypage,myname, w, h){
	var win;
  var winl = (screen.width-w)/2;
  var wint = (screen.height-h)/2;
  var settings  ='height='+h+',';
      settings +='width='+w+',';
      settings +='top='+wint+',';
      settings +='left='+winl+',scrollbars=yes';
      
  win=window.open(mypage,myname,settings);
  if(parseInt(navigator.appVersion) >= 4){win.window.focus();}
}

// -------------------------------------------------------------------------
// HERE BEGINS THE CSS INFORMATION FOR MAC USERS WITH NETSCAPE
// -------------------------------------------------------------------------
if ((is.nav4) && (is.mac))
	{ SITE_CSS = '<style type="text/css">' +
	'</style>';
		}
// -------------------------------------------------------------------------
// HERE BEGINS THE CSS INFORMATION FOR WINDOWS USERS WITH IE 4+
// AND NETSCAPE 6 & OPERA ON ALL PLATFORMS.
// -------------------------------------------------------------------------
else if (((is.ie4up) && (is.win)) || (is.nav5up) || (is.opera))
	{ SITE_CSS = '<style type="text/css">' +
	'</style>';
		}
// -------------------------------------------------------------------------
// HERE BEGINS THE CSS INFORMATION FOR MAC USERS WITH IE
// -------------------------------------------------------------------------
if ((is.ie4up) && (is.mac))
	{ SITE_CSS = '<style type="text/css">' +
	'</style>';
		}
// -------------------------------------------------------------------------
// HERE BEGINS THE CSS INFORMATION FOR ALL OTHER VISITORS
// -------------------------------------------------------------------------
else { SITE_CSS = '<style type="text/css">' +
	'</style>';
		}
// -------------------------------------------------------------------------
	//document.write(SITE_CSS)