function init(){
	header();
	footer();
	container();
	leftPanel();
	content();
	rightPanel(); 
	menu();
	bookmark();
}
function footer(){
	var footer = document.getElementById("footer");
	footer.style.top = getHeight()+315+"px";
	footer.style.left = getLeft()+1+"px";		
}
function header(){
	var header = document.getElementById("header");		
	header.style.left = getLeft()+1+"px";
}
function container(){
	var container = document.getElementById("container");
	container.style.top = 236+"px";
	container.style.height = getHeight()+79+"px";
	container.style.left = getLeft()+"px";
}
function leftPanel(){
	var leftPanel = document.getElementById("leftPanel");
	leftPanel.style.top = 236+"px";
	leftPanel.style.left = getLeft()+1+"px";
}
function content(){
	var content = document.getElementById("content");
	content.style.top = 315+"px";
	content.style.left = getLeft()+265+"px";
}
function rightPanel(){
	var rightPanel = document.getElementById("rightPanel");
	rightPanel.style.top = 315+"px";
	rightPanel.style.left = getLeft()+790+"px";
}
function bookmark(){
	var bookmark = document.getElementById("bookmark");
	bookmark.style.top = 256+"px";
	bookmark.style.left = getLeft()+280+"px";
}
function menu(){
	var menu = document.getElementById("menu");
	menu.style.top = 215+"px";
	menu.style.left = document.body.clientWidth/2-30+"px";
}
function getHeight(){
	var h1=document.getElementById("leftPanel").offsetHeight;
	var h2=document.getElementById("content").offsetHeight;
	var h3=document.getElementById("rightPanel").offsetHeight;
	var mh=Math.max(Math.max(h1,h2),h3);
	return mh;
}
function getLeft(){
	var totwid=0;
	if (window.innerWidth)
	{
		totwid = window.innerWidth;
	}
	else if (document.documentElement && document.documentElement.clientWidth)
	{
		totwid = document.documentElement.clientWidth;
	}
	else if (document.body)
	{
		totwid = document.body.clientWidth;
	}
	//var totwid=document.body.clientWidth/2;
	var wid=document.getElementById("container").offsetWidth;
	var adjleft=(totwid-wid)/2;
	return adjleft;
}
function validation() { 
	var name=document.contactus.name.value;
	var organization=document.contactus.organization.value;
	var telephone=document.contactus.telephone.value;
	var email=document.contactus.email.value;
	var comments=document.contactus.comments.value;
	name=name.replace(/^\s*|\s*$/g,"");
	organization=organization.replace(/^\s*|\s*$/g,"");
	telephone=telephone.replace(/^\s*|\s*$/g,"");
	email=email.replace(/^\s*|\s*$/g,"");
	comments=comments.replace(/^\s*|\s*$/g,"");
	if (name == '') {
		  alert("Please Fill Proper Name");
		  document.contactus.name.focus();
		  return false;
	}
	if (organization == '') {
		  alert("Please Fill Proper Organization Name");
		  document.contactus.organization.focus();
		  return false;
	}
	if (telephone=='') {
		  alert("Please Fill Your Telephone Number");
		  document.contactus.telephone.focus();
		  return false;
	}
	if (email == '' || isValidEmail(email)==false) {
		  alert("Please Fill Proper Email");
		  document.contactus.email.focus();
		  return false;
	}
}
function isValidEmail(str) {
	return (str.indexOf(".") > 2) && (str.indexOf("@") > 0);
}
function ReplaceContent(layerName){
	if(ie){document.all[layerName].innerHTML = ContentInfo}
	if(ns){
		with(document.layers[layerName].document) 
		{ 
		   open(); 
		   write(ContentInfo); 
		   close(); 
		}
	}
}
function Activate(){initialize=1}
function deActivate(){initialize=0}

function showLayer(layerName){
	document.getElementById(layerName).style.display="block";
}
function hideLayer(layerName){
	document.getElementById(layerName).style.display="none";
}
function getFuncs(){ 
	runSlideShow(); 
}





/* image zoom */

//new window open
//new window open
function ShowWindow(url)
{
	window.open (url, 'newwindowrtm', config='height=250,width=350, titlebar=no, toolbar=no, menubar=no,scrollbars=yes, resizable=no,location=no, directories=on, status=no right=600,top=600,screenX=0,screenY=0')
}
//ned open window
 
function linkLocation(location) { 
		window.location.href=location;
}
function changeTo(callerId,newSrc) {
document.getElementById(callerId).src = newSrc;
}


var isNN = (navigator.appName.indexOf("Netscape")!=-1);
function autoTab(input,len, e) {
var keyCode = (isNN) ? e.which : e.keyCode;
var filter = (isNN) ? [0,8,9] : [0,8,9,16,17,18,37,38,39,40,46];
if(input.value.length >= len && !containsElement(filter,keyCode)) {
input.value = input.value.slice(0, len);
input.form[(getIndex(input)+1) % input.form.length].focus();
}
function containsElement(arr, ele) {
var found = false, index = 0;
while(!found && index < arr.length)
if(arr[index] == ele)
found = true;
else
index++;
return found;
}
function getIndex(input) {
var index = -1, i = 0, found = false;
while (i < input.form.length && index == -1)
if (input.form[i] == input)index = i;
else i++;
return index;
}
return true;
}


// for checkbox select one
function checkBoxValidate(cb) {
for (j = 0; j < 2; j++) {
if (eval("document.contactus.sex[" + j + "].checked") == true) {
document.contactus.sex[j].checked = false;
if (j == cb) {
document.contactus.sex[j].checked = true;
         }
      }
   }
}
//  End -->

/*function ReplaceContent(layerName){

if(ie){document.all[layerName].innerHTML = ContentInfo}


if(ns){

with(document.layers[layerName].document) 
{ 
   open(); 
   write(ContentInfo); 
   close(); 
}

}
}
function Activate(){initialize=1}
function deActivate(){initialize=0}

function showLayer(layerName)
{
  document.getElementById(layerName).style.display="block";
}
function hideLayer(layerName)
{

document.getElementById(layerName).style.display="none";

}*/

//***********************************************/

var dom = (document.getElementById) ? true : false;
var ns5 = (!document.all && dom || window.opera) ? true: false;
var ie5 = ((navigator.userAgent.indexOf("MSIE")>-1) && dom) ? true : false;
var ie4 = (document.all && !dom) ? true : false;
var nodyn = (!ns5 && !ie4 && !ie5 && !dom) ? true : false;

var origWidth, origHeight;

// avoid error of passing event object in older browsers
if (nodyn) { event = "nope" }

///////////////////////  CUSTOMIZE HERE   ////////////////////
// settings for tooltip 
// Do you want tip to move when mouse moves over link?
var tipFollowMouse= true;	
// Be sure to set tipWidth wide enough for widest image
var tipWidth= 350;
var offX= 20;	// how far from mouse to show tip
var offY= 12; 
var tipFontFamily= "Verdana";
var tipFontSize= "11px";
// set default text color and background color for tooltip here
// individual tooltips can have their own (set in messages arrays)
// but don't have to
var tipFontColor= "#000000";
var tipBgColor= "#FFFFFF"; 
var tipBorderColor= "#000000";
var tipBorderWidth= 4;
var tipBorderStyle= "ridge";
var tipPadding= 4;

// tooltip content goes here (image, description, optional bgColor, optional textcolor)
var messages = new Array();
// multi-dimensional arrays containing: 
// image and text for tooltip
// optional: bgColor and color to be sent to tooltip
messages[0] = new Array('images/affiliates.gif','');

										    
            
////////////////////  END OF CUSTOMIZATION AREA  ///////////////////

// preload images that are to appear in tooltip
// from arrays above
if (document.images) {
	var theImgs = new Array();
	for (var i=0; i<messages.length; i++) {
  	theImgs[i] = new Image();
		theImgs[i].src = messages[i][0];
  }
}
var startStr = '<table  width="'+ tipWidth + '"><tr><td><div style="border:1px red solid;"><img src="';
var endStr = '</td></tr></table>';

////////////////////////////////////////////////////////////
//  initTip	- initialization for tooltip.
//		Global variables for tooltip. 
//		Set styles
//		Set up mousemove capture if tipFollowMouse set true.
////////////////////////////////////////////////////////////
var tooltip, tipcss;
function initTip() {
	if (nodyn) return;
	tooltip = (ie4)? document.all['tipDiv']: (ie5||ns5)? document.getElementById('tipDiv'): null;
	tipcss = tooltip.style;
	if (ie4||ie5||ns5) {	// ns4 would lose all this on rewrites
		tipcss.width = tipWidth+"px";
		tipcss.fontFamily = tipFontFamily;
		tipcss.fontSize = tipFontSize;
		tipcss.color = tipFontColor;
		tipcss.backgroundColor = tipBgColor;
		tipcss.borderColor = tipBorderColor;
		tipcss.borderWidth = tipBorderWidth+"px";
		tipcss.padding = tipPadding+"px";
		tipcss.borderStyle = tipBorderStyle;
	}
	if (tooltip&&tipFollowMouse) {
		document.onmousemove = trackMouse;
	}
}

window.onload = initTip;

/////////////////////////////////////////////////
//  doTooltip function
//			Assembles content for tooltip and writes 
//			it to tipDiv
/////////////////////////////////////////////////
var t1,t2;	// for setTimeouts
var tipOn = false;	// check if over tooltip link
function doTooltip(evt,num,id,paramStr) {
	
	var midStr = paramStr;
    //alert(paramStr);
 
	if (!tooltip) return;
	if (t1) clearTimeout(t1);	if (t2) clearTimeout(t2);
	tipOn = true;
	// set colors if included in messages array
	if (messages[num][2])	var curBgColor = messages[num][2];
	else curBgColor = tipBgColor;
	if (messages[num][3])	var curFontColor = messages[num][3];
	else curFontColor = tipFontColor;
	if (ie4||ie5||ns5) {
		//var tip = startStr + messages[num][0] + midStr + '<span style="font-family:' + tipFontFamily + '; font-size:' + tipFontSize + '; color:' + curFontColor + ';">' + messages[num][1] + '</span>' + endStr;
		//alert(tip);
		//document.write(tip);
		var tip =midStr;
		tipcss.backgroundColor = curBgColor;
	 	tooltip.innerHTML = tip;
	}
	if (!tipFollowMouse) positionTip(evt);
	else t1=setTimeout("tipcss.visibility='visible'",100);
    // viewid(id);
}

var mouseX, mouseY;
function trackMouse(evt) {
	standardbody=(document.compatMode=="CSS1Compat")? document.documentElement : document.body //create reference to common "body" across doctypes
	mouseX = (ns5)? evt.pageX: window.event.clientX + standardbody.scrollLeft;
	mouseY = (ns5)? evt.pageY: window.event.clientY + standardbody.scrollTop;
	if (tipOn) positionTip(evt);
}

/////////////////////////////////////////////////////////////
//  positionTip function
//		If tipFollowMouse set false, so trackMouse function
//		not being used, get position of mouseover event.
//		Calculations use mouseover event position, 
//		offset amounts and tooltip width to position
//		tooltip within window.
/////////////////////////////////////////////////////////////
function positionTip(evt) {
	if (!tipFollowMouse) {
		standardbody=(document.compatMode=="CSS1Compat")? document.documentElement : document.body
		mouseX = (ns5)? evt.pageX: window.event.clientX + standardbody.scrollLeft;
		mouseY = (ns5)? evt.pageY: window.event.clientY + standardbody.scrollTop;
	}
	// tooltip width and height
	var tpWd = (ie4||ie5)? tooltip.clientWidth: tooltip.offsetWidth;
	var tpHt = (ie4||ie5)? tooltip.clientHeight: tooltip.offsetHeight;
	// document area in view (subtract scrollbar width for ns)
	var winWd = (ns5)? window.innerWidth-20+window.pageXOffset: standardbody.clientWidth+standardbody.scrollLeft;
	
	//alert(winWd);
	var winHt = (ns5)? window.innerHeight-20+window.pageYOffset: standardbody.clientHeight+standardbody.scrollTop;
	// check mouse position against tip and window dimensions
	// and position the tooltip 
	if ((mouseX+offX+tpWd)>winWd) 
		tipcss.left = mouseX-(tpWd+offX)+"px";
	else tipcss.left = mouseX+offX+"px";
	if ((mouseY+offY+tpHt)>winHt) 
		tipcss.top = winHt-(tpHt+offY)+"px";
	else tipcss.top = mouseY+offY+"px";
	if (!tipFollowMouse) t1=setTimeout("tipcss.visibility='visible'",100);
}

function hideTip() {
	if (!tooltip) return;
	t2=setTimeout("tipcss.visibility='hidden'",100);
	tipOn = false;
}

document.write('<div id="tipDiv" style="position:absolute; visibility:hidden; z-index:100"></div>')

