


0// JavaScript Document

var menuInt;
var nextTabDepth = 106;

function init()
{
	var tabs = document.getElementsByTagName("div")
	for(i=0;i<tabs.length;i++)
	{
		if( tabs[i].id )
		{
			if( tabs[i].id.indexOf("tab_") > -1 )
			{
				//alert(tabs[i].id);
				tabs[i].numid = tabs[i].id.split("_")[1];
				tabs[i].up = false;
				tabs[i].yPos = tabs[i].parentNode.style.bottom;
				tabs[i].h = tabs[i].style.height;
				tabs[i].slideInt = null;
				//alert(tabs[i].numid)
				tabs[i].hit = document.getElementById('tablink_'+tabs[i].numid)
				tabs[i].hit.onclick = function()
				{
					var parent = this.parentNode;
					//alert(parent)
					//
					if(!parent.up)
					{
						parent.up = true;
						parent.style.zIndex = nextTabDepth++;
						parent.slideInt = setInterval("slideUp('"+parent.id+"')",40);
						
						for(j=0;j<tabs.length;j++)
						{
							if( tabs[j].id )
							{
								if( tabs[j].id.indexOf("tab_") > -1 && tabs[j] != parent )
								{
									clearInterval(tabs[j].slideInt);
									tabs[j].up = false;
									tabs[j].style.height = tabs[j].h;
								}
							}
						}
					}
					else
					{
						parent.up = false;
						parent.style.height = parent.h;
					}
				}
			}
		}
	}
	
	//giving the pdf links the pdf icon beside them
	var a = document.getElementsByTagName("A")
		for( i=0;i<a.length;i++ )
		//alert("yes")
		{
			if( a[i].href.indexOf('.pdf') != -1 || a[i].href.indexOf('.PDF') != -1 )
			{

				a[i].style.paddingRight = '18px'
				a[i].style.background = 'url(/images/ico_pdf.gif) top right no-repeat'
			}
			
			if( a[i].href.indexOf('mailto:') != -1 || a[i].href.indexOf('MAILTO:') != -1 )
			{
				a[i].style.paddingRight = '18px'
				a[i].style.background = 'url(/images/ico_mail.gif) top right no-repeat'
			}
		}

}

function slideUp(id)
{
	var endH = 150;
	var speed = 2;
	var div = document.getElementById(id);
	//var curY = parseInt(div.style.bottom.replace("px",""));
	var curH = parseInt(div.style.height.replace("px",""));
	//curY += Math.ceil((endY-curY)/speed);
	curH += Math.ceil((endH-curH)/speed);
	//div.style.bottom = curY + "px";
	div.style.height = curH + "px";
	if( curH == endH ) clearInterval(div.slideInt);
}


function menuOver(div,num)
{
	clearInterval(menuInt);
	if(div) showMenu(div,num);
	
}

function menuOut()
{
	menuInt = setTimeout('hideMenu()',500);
}

function showMenu(div,num)
{
	
	var w = Math.ceil(num/15)*185;
	var sub = document.getElementById('sub');
	var menuitems = document.getElementById('menuitems');
	var code = document.getElementById('sub'+div.id).innerHTML;
	var shadow = document.getElementById('shadow')
	sub.style.display = "block";
	//alert(findPosY(div))
	var amt = (BrowserDetect.browser == "Explorer") ? (div.offsetParent.offsetTop + div.offsetTop) + "px" : (div.offsetTop + 115) + "px";
	sub.style.top = amt;
	sub.style.width = w + "px";
	shadow.style.width = (w+15) + "px";
	menuitems.innerHTML = code;
	//alert(code);
	//alert(amt);
}

function hideMenu()
{
	var sub = document.getElementById('sub');
	sub.style.display = "none";
}

function findPosY(obj)
{
	var curtop = 0;
	if(obj.offsetParent)
        while(1)
        {
          curtop += obj.offsetTop;
          if(!obj.offsetParent)
            break;
          obj = obj.offsetParent;
        }
    else if(obj.y)
        curtop += obj.y;
    return curtop;
}

var BrowserDetect = {
	init: function () {
		this.browser = this.searchString(this.dataBrowser) || "An unknown browser";
		this.version = this.searchVersion(navigator.userAgent)
			|| this.searchVersion(navigator.appVersion)
			|| "an unknown version";
		this.OS = this.searchString(this.dataOS) || "an unknown OS";
	},
	searchString: function (data) {
		for (var i=0;i<data.length;i++)	{
			var dataString = data[i].string;
			var dataProp = data[i].prop;
			this.versionSearchString = data[i].versionSearch || data[i].identity;
			if (dataString) {
				if (dataString.indexOf(data[i].subString) != -1)
					return data[i].identity;
			}
			else if (dataProp)
				return data[i].identity;
		}
	},
	searchVersion: function (dataString) {
		var index = dataString.indexOf(this.versionSearchString);
		if (index == -1) return;
		return parseFloat(dataString.substring(index+this.versionSearchString.length+1));
	},
	dataBrowser: [
		{ 	string: navigator.userAgent,
			subString: "OmniWeb",
			versionSearch: "OmniWeb/",
			identity: "OmniWeb"
		},
		{
			string: navigator.vendor,
			subString: "Apple",
			identity: "Safari"
		},
		{
			prop: window.opera,
			identity: "Opera"
		},
		{
			string: navigator.vendor,
			subString: "iCab",
			identity: "iCab"
		},
		{
			string: navigator.vendor,
			subString: "KDE",
			identity: "Konqueror"
		},
		{
			string: navigator.userAgent,
			subString: "Firefox",
			identity: "Firefox"
		},
		{
			string: navigator.vendor,
			subString: "Camino",
			identity: "Camino"
		},
		{		// for newer Netscapes (6+)
			string: navigator.userAgent,
			subString: "Netscape",
			identity: "Netscape"
		},
		{
			string: navigator.userAgent,
			subString: "MSIE",
			identity: "Explorer",
			versionSearch: "MSIE"
		},
		{
			string: navigator.userAgent,
			subString: "Gecko",
			identity: "Mozilla",
			versionSearch: "rv"
		},
		{ 		// for older Netscapes (4-)
			string: navigator.userAgent,
			subString: "Mozilla",
			identity: "Netscape",
			versionSearch: "Mozilla"
		}
	],
	dataOS : [
		{
			string: navigator.platform,
			subString: "Win",
			identity: "Windows"
		},
		{
			string: navigator.platform,
			subString: "Mac",
			identity: "Mac"
		},
		{
			string: navigator.platform,
			subString: "Linux",
			identity: "Linux"
		}
	]

};
BrowserDetect.init();

function MM_openBrWindow(theURL,winName,features) { //v2.0
  window.open(theURL,winName,features);
}

function popUp() {

/* begin configuration */
var url = "mapWi.htm"; 
var w = "750"; 
var h = "620"; 
var menu = "no"; 
var scroll = "no"; 
var tool = "no"; 
var location = "no"; 
var resize = "no";
/* end configuration */

var winl = (screen.width - w) / 2;
var wint = (screen.height - h) / 2;
winprops = 'width='+w+', height='+h+', top='+wint+', left='+winl+', menubar='+menu+', scrollbars='+scroll+', toolbar='+tool+', location='+location+', resizable='+resize+''
window.open(url, 'popup', winprops);
}

function popUp2() {

/* begin configuration */
var url = "mapWi2.htm"; 
var w = "750"; 
var h = "620"; 
var menu = "no"; 
var scroll = "no"; 
var tool = "no"; 
var location = "no"; 
var resize = "no";
/* end configuration */

var winl = (screen.width - w) / 2;
var wint = (screen.height - h) / 2;
winprops = 'width='+w+', height='+h+', top='+wint+', left='+winl+', menubar='+menu+', scrollbars='+scroll+', toolbar='+tool+', location='+location+', resizable='+resize+''
window.open(url, 'popup', winprops);
}

function confirmSubmit()
	{
		var agree=confirm("This action can not be undone. Are you sure you want to continue?");
		if (agree)
			return true ;
		else
			return false ;
	}
	
function validate(form,findclass)
{
	//alert("yes")
//	return false;
	var tag=document.body.getElementsByTagName('*');
	var errormsg = document.getElementById('errormsg')
	var errormsgemail = document.getElementById('errormsg_email')
	var txt = ''
	for(var i=0; i<tag.length; i++) 
	{
		if(tag[i].className == findclass+'_email')
			{
				if(tag[i].value.indexOf('@') == -1 || tag[i].value.indexOf(".") == -1)
				{
					//alert("yes")
					errormsgemail.style.display = "block"
					errormsgemail.style.color = "#C00"
					errormsgemail.style.fontWeight = 'bold'
					errormsgemail.style.padding = '10px'
					tag[i].style.border = '#C00 solid 3px'
					//tag[i].style.marginRight = '18px'
					//tag[i].style.background = 'url(/images/ico_checkmark.png) top right no-repeat'
					tag[i].focus();
					return false;
				}
			}
		if(tag[i].className == findclass)
			{
				//alert(tag[i].value.indexOf('@'))
				//tag[i].style.className = 'ERROR'
					//confirm(tag[i].name)
				if(tag[i].value == '')
				{
					errormsg.style.display = "block"
					errormsg.style.color = "#C00"
					errormsg.style.fontWeight = 'bold'
					errormsg.style.padding = '10px'
					tag[i].style.border = '#C00 solid 3px'
					//tag[i].style.marginRight = '18px'
					//tag[i].style.background = 'url(/images/ico_checkmark.png) top right no-repeat'
					tag[i].focus();
					return false;
				}
			}
	}
	//sendForm()
}
