﻿// JScript File

function externalLinks() { 

	if (!document.getElementsByTagName) return; 

	var anchors = document.getElementsByTagName("a"); 
	for (var i=0; i<anchors.length; i++) { 
		var anchor = anchors[i]; 
		var relvalue = anchor.getAttribute("rel");

		if (anchor.getAttribute("href")) {
			var external = /external/;
			var relvalue = anchor.getAttribute("rel");
			if (external.test(relvalue)) { anchor.target = "_blank"; }
		} 
	}
} 
window.onload = externalLinks;


function ShowEmail(user, domain, anchor) {
	var OutText = '';
	OutText += '<a href="mailto:' + user + '@' + domain + '">';
	if (anchor != '') OutText += anchor;
	else OutText += user + '@' + domain;
	OutText  += '</a>';
	document.write(OutText);
}

function MM_openBrWindow(theURL,winName,features) { //v2.0
  window.open(theURL,winName,features);
}

//--------------SHOW/HIDE LAYERS----------------//
var origWidth, origHeight;
if (document.layers) {
	origWidth = window.innerWidth; origHeight = window.innerHeight;
	window.onresize = function() { if (window.innerWidth != origWidth || window.innerHeight != origHeight) history.go(0); }
}

var cur_lyr;
function swapLayers(id) {
  if (cur_lyr) hideLayer(cur_lyr);
  showLayer(id);
  cur_lyr = id;
}

function showLayer(id) {
  var lyr = getElemRefs(id);
  if (lyr && lyr.css) lyr.css.display = "block";
}

function hideLayer(id) {
  var lyr = getElemRefs(id);
  if (lyr && lyr.css) lyr.css.display = "none";
}

function getElemRefs(id) {
	var el = (document.getElementById)? document.getElementById(id): (document.all)? document.all[id]: (document.layers)? document.layers[id]: null;
	if (el) el.css = (el.style)? el.style: el;
	return el;
}



function TextTicker(phrase1,phrase2,phrase3,phrase4,phrase5,link,window) {

	var strFlash;
	var count = 0;

	if(phrase1 != '')
		count++;
	if(phrase2 != '')
		count++;
	if(phrase3 != '')
		count++;
	if(phrase4 != '')
		count++;
	if(phrase5 != '')
		count++;

	strFlash = '<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,29,0" width="350" height="15">';
	strFlash += '<param name="movie" value="swf/ticker.swf?count=' + count + '&phrase1=' + phrase1 + '&phrase2=' + phrase2 + '&phrase3=' + phrase3 + '&phrase4=' + phrase4 + '&phrase5=' + phrase5 + '&link=' + link + '&window=' + window + '">';
	strFlash += '<param name="quality" value="high">';
	strFlash += '<embed src="swf/ticker.swf?count=' + count + '&phrase1=' + phrase1 + '&phrase2=' + phrase2 + '&phrase3=' + phrase3 + '&phrase4=' + phrase4 + '&phrase5=' + phrase5 + '&link=' + link + '&window=' + window + '" quality="high" pluginspage="http://www.macromedia.com/go/getflashplayer" type="application/x-shockwave-flash" width="350" height="15"></embed></object>';

	document.write(strFlash);
}

function MM_openBrWindow(theURL,winName,features) { //v2.0
  wind = window.open(theURL,winName,features);
  wind.focus();
}

function doHidePngPopUp(selectedDiv) {
	popdiv=document.getElementById(selectedDiv)
	popdiv.style.visibility="hidden"
}

function doHidePopUp() {
	popdiv=document.getElementById("divpopup")
	popdiv.style.visibility="hidden"
}

function doHidePngPopUp2() {
	popdiv=document.getElementById("divpopup2")
	popdiv.style.visibility="hidden"
}
	
function doShowPopUp(){
	popdiv=document.getElementById("divpopup")
	popdiv.style.left="50%"
	popdiv.style.marginLeft="-183px"
	if ((is_ie5up) && (is_mac)){ //fix for ie-mac does not accept popdiv.style.top="50%"
		popdiv.style.top="0px"
		popdiv.style.marginTop="0px"
	}else{
		popdiv.style.top="50%"
		popdiv.style.marginTop="-132px"
	}
	popdiv.style.visibility="visible"
}

function openWindow(theURL,winName,features) {
  window.open(theURL,winName,features);
}

function showPic (whichpic) {
 if (document.getElementById) {
  document.getElementById('ctl00_ContentPlaceHolder4_placeholder').style.background = "url(" + whichpic.href + ") 50% 50% no-repeat";
  return false;
 } else {
  return true;
 }
}

function show_hide(strElem,true_false) {
    theElem = document.getElementById(strElem);
    if(!theElem) { return false }

    if(true_false) {
	    theElem.style.display = "";
    } else {
	    theElem.style.display = "none";
    }
}
	    
	    
function show_hide2(strElem,selectedValue) {
    theElem = document.getElementById(strElem);
    if(!theElem) { return false }

    if(selectedValue == "other")
	    theElem.style.display = "";
    else 
	    theElem.style.display = "none";
}
	    