//  ||||||||||||||||||||||||||||||||||||||||||||||||||
//  Placeways LLC global javascript
//  ||||||||||||||||||||||||||||||||||||||||||||||||||



//--------------------------------------------------------------->
var ie5 = (document.getElementById && document.all);
var ns6 = (document.getElementById && !document.all);
//--------------------------------------------------------------->


//--------------------------------------------------------------->

MyDate = {
	days : ["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],
	months : ["January","February","March","April","May","June","July","August","September","October","November","December"],

	setDate : function(){
		var now = new Date();
		this.day = this.days[now.getDay()];
		this.date = now.getDate();
		this.month = this.months[now.getMonth()];
		this.year = now.getFullYear();
	},
	getDate : function(){
		this.setDate();
		return this.day+", "+this.month+" "+this.date+", "+this.year;
	}
}

//--------------------------------------------------------------->

function showDate(){
	document.getElementById("theDate").innerHTML = MyDate.getDate();
}
function initDate(){
	showDate();
}

//--------------------------------------------------------------->

function noSpam(user,domain) {
locationstring = "mailto:" + user + "@" + domain;
window.location = locationstring;
}
//--------------------------------------------------------------->

function externalLinks() { 
 if (!document.getElementsByTagName) return; 
 var anchors = document.getElementsByTagName("a"); 
 for (var i=0; i<anchors.length; i++) { 
   var anchor = anchors[i]; 
   if (anchor.getAttribute("href") && 
       anchor.getAttribute("rel") == "external") 
     anchor.target = "_blank"; 
 } 
}
//--------------------------------------------------------------->
function setStatus(msg){
	window.status = msg;
	return true;
}
//--------------------------------------------------------------->
function hideStatus(){
var statusmsg=""
window.status = statusmsg
return true;
}
//--------------------------------------------------------------->
function disable()
{
event.button == false;

}
//--------------------------------------------------------------->
// Heinle's function for retrieving a cookie.
function getCookie(name){
  var cname = name + "=";
  var dc = document.cookie;
  if (dc.length > 0) {
    begin = dc.indexOf(cname);
    if (begin != -1) {
      begin += cname.length;
      end = dc.indexOf(";", begin);
      if (end == -1) end = dc.length;
        return unescape(dc.substring(begin, end));
    }
  }
  return null;
}
//--------------------------------------------------------------->
// An adaptation of Dorcht's function for setting a cookie.
function setCookie(name, value, expires, path, domain, secure) {
  document.cookie = name + "=" + escape(value) +
  ((expires == null) ? "" : "; expires=" + expires.toGMTString()) +
  ((path == null) ? "" : "; path=" + path) +
  ((domain == null) ? "" : "; domain=" + domain) +
  ((secure == null) ? "" : "; secure");
}
//--------------------------------------------------------------->
// An adaptation of Dorcht's function for deleting a cookie.
function delCookie (name,path,domain) {
  if (getCookie(name)) {
    document.cookie = name + "=" +
    ((path == null) ? "" : "; path=" + path) +
    ((domain == null) ? "" : "; domain=" + domain) +
    "; expires=Thu, 01-Jan-70 00:00:01 GMT";
  }
}




//--------------------------------------------------------------->
var firstCall = true;

function changeFontSize(fSize, increment) {
  if (firstCall) {
    firstCall = false;
    if (increment != "")
      changeFontSize('12', '');
  }
  if (document.getElementsByTagName) {
    tags = new Array ("p", "li", "h3", "h4", "h5", "h6", "body");
    for (j=0; j<tags.length; j++) {
      var getElement = document.getElementsByTagName(tags[j]);
      var eachElement, currentFontSize, fontIncrease, newFontSize;
      for (i=0; i<getElement.length; i++) {
        eachElement = getElement[i];
        if (increment != "") {
          currentFontSize = parseInt(eachElement.style.fontSize);
          fontIncrease = parseInt(increment);
          newFontSize = currentFontSize + fontIncrease;
          }
        else if (fSize != "")
          newFontSize = parseInt(fSize);
        if (tags[j] == "li")
          eachElement.style.lineHeight = Math.round(newFontSize*1.2) + "px";
        else
          eachElement.style.lineHeight = Math.round(newFontSize*1.5) + "px";
        if (fSize != "") {
          switch(tags[j]) {
          case "h1": newFontSize += 4; break;
          case "h2": newFontSize += 3; break;
          case "h3": newFontSize += 2; break;
          case "h4": newFontSize += 1; break;
          case "h5": newFontSize += 1; break;
          case "h6": newFontSize += 1;
          }
        }
        eachElement.style.fontSize = newFontSize + "px";
        setCookie('fontSize', newFontSize);
      }
    }
  }
}
//--------------------------------------------------------------->
function chgBG(id,color)
{
document.getElementById(id).style.background=color;
}
//--------------------------------------------------------------->
function blinkTxt() {
    	if(document.getElementById) {
		var div = document.getElementById("loader");
			if (div.style.visibility=="hidden"){
				div.style.visibility="visible";
    			}
    			else{
				div.style.visibility="hidden";
    			}
		}
  	}


//--------------------------------------------------------------->
function randTxt(id)
{
	if(document.getElementById){

	var num = Math.floor(Math.random()* coverTxt.length)
		var div = document.getElementById(id);
		div.innerHTML = ""; 
		div.innerHTML = coverTxt[num];
	}
}
//--------------------------------------------------------------->
function randImg(id)
{
	if(document.getElementById){

	var num = 5;
		var div = top.document.getElementById(id);
		div.style.backgroundImage = "url(img/home/rand/rand_"+[Math.floor(Math.random() * num)+ 1]+".jpg)";
	}
}
//--------------------------------------------------------------->
function randImgHome(id,str)
{
	if(document.getElementById){

	var num = 5;
		var div = top.document.getElementById(id);
		div.style.backgroundImage = "url(img/home/rand_"+[str]+"/rand_"+[str]+"_"+[Math.floor(Math.random() * num)+ 1]+".jpg)";
	}
}
//--------------------------------------------------------------->
function randImgL(id)
{
	if(document.getElementById){

	var num = 5;
		var div = top.document.getElementById(id);
		div.style.backgroundImage = "url(img/home/rand_left/rand_left_"+[Math.floor(Math.random() * num)+ 1]+".jpg)";
	}
}
//--------------------------------------------------------------->
function randImgC(id)
{
	if(document.getElementById){

	var num = 5;
		var div = top.document.getElementById(id);
		div.style.backgroundImage = "url(img/home/rand_center/rand_center_"+[Math.floor(Math.random() * num)+ 1]+".jpg)";
	}
}
//--------------------------------------------------------------->
function randImgR(id)
{
	if(document.getElementById){

	var num = 5;
		var div = top.document.getElementById(id);
		div.style.backgroundImage = "url(img/home/rand_right/rand_right_"+[Math.floor(Math.random() * num)+ 1]+".jpg)";
	}
}
//--------------------------------------------------------------->
function randBgdImg()
{
	var num = 5;
	if(document.getElementById){
    		bdy = document.getElementsByTagName("body");
    		bdy[0].style.width = "100%";
    		bdy[0].style.height = "100%";
          bdy[0].style.margin = "0px";
		bdy[0].style.backgroundImage = "url(img/bgd/bgdimg"+[Math.floor(Math.random() * num)+ 1]+".jpg)";
		bdy[0].style.backgroundRepeat = "no-repeat";

	}
}
//--------------------------------------------------------------->

function printWindow(){
   bV = parseInt(navigator.appVersion)
   if (bV >= 4) window.print()
}


//--------------------------------------------------------------->
function blurAnchors(){
	if(document.getElementById){
    		var a=document.getElementsByTagName("a");
    		for(i=0;i<a.length;i++){
    			a[i].onfocus=function(){this.blur()};
    		}
	}
}
//--------------------------------------------------------------->
function preloadImages(){
	if (document.images){
	var myimages=new Array();
	for (i=0;i<preloadImages.arguments.length;i++){
	myimages[i]=new Image();
	myimages[i].src=preloadImages.arguments[i];
	}
}
}

//--------------------------------------------------------------->
// img swap
//--------------------------------------------------------------->
function On(imgName)
{
	if (document.images)
	{
		document[imgName].src = eval(imgName +"On.src");
	}
}

function Off(imgName)
{
	if (document.images)
	{
		document[imgName].src = eval(imgName +"Off.src");
	}
}

function preload_alt(imgObj,imgSrc) {
	if (document.images) {
		eval(imgObj+' = new Image()')
		eval(imgObj+'.src = "'+imgSrc+'"')
	}
}


function imgSwap(imgName,imgObj) {
	if (document.images) {
	document.images[imgName].src = eval(imgObj+".src")
	}
}

function imgSwap_alt(imgName,imgObj,divNames){
	if(document.layers && divnames != null){
		divnames = divnames.split(',');
		var d = '';
		for(var i=0; i<divnames.length; i++){
			d += 'document.'+divnames[i]+'.';
		}
		eval(d+'document.images["'+imgname+'"].src = '+imgobj+'.src');
	}else{
		document.images[imgname].src = eval(imgobj+'.src');
	}
}

function changeCurrent(imgName){
	if(document.images){
		document[current].src=eval(current+"_off.src");
		document[imgName].src = eval(imgName+"_on.src");
		current = imgName;
	}
}
//--------------------------------------------------------------->
function jumpMenu(targ,selObj,restore){ 
  eval(targ+".location='"+selObj.options[selObj.selectedIndex].value+"'");
  if (restore) selObj.selectedIndex=0;
}


//--------------------------------------------------------------->
function setStyle(){
				
				var platform
				if (navigator.userAgent.indexOf('Mac') != -1){
					var platform = "mac";
  				}else{
  					var platform = "pc";
  				}
  				
  				
  				if (navigator.appName.indexOf('Microsoft') != -1){
      				var browser = "IE"
  				} else {
  					var browser = "NS"
  				}

  				if ((navigator.appName.indexOf('Mac') != 1) && (navigator.appName.indexOf('Microsoft') != 1)){
      				var browser = "other"
  				} 
  				
  				
  				
  				if (platform == "mac") {
  				if (browser == "IE"){
  				document.write('<link rel="stylesheet" type="text/css" href="global_iemac.css">')
  				}else if (browser == "NS") {
  					document.write('<link rel="stylesheet" type="text/css" href="global_iepc.css">')
  				}
  				}
  				if (platform == "pc") {
  				if (browser == "IE"){
  				document.write('<link rel="stylesheet" type="text/css" href="global_iepc.css">')
  				}else if (browser == "NS") {
  					document.write('<link rel="stylesheet" type="text/css" href="global_nspc.css">')
  				}
  				}
  				}
			
//--------------------------------------------------------------->			
			

function setActiveStyleSheet(title) {
   var i, a, main;
   for(i=0; (a = document.getElementsByTagName("link")[i]); i++) {
     if(a.getAttribute("rel").indexOf("style") != -1
        && a.getAttribute("title")) {
       a.disabled = true;
       if(a.getAttribute("title") == title) a.disabled = false;
     }
   }
}

//--------------------------------------------------------------->
function hide(id) {
	if(document.getElementById){
	var el = top.document.getElementById(id);
	el.style.display = "none";
	return false;			
	}
}
//--------------------------------------------------------------->
function show(id) {
	if(document.getElementById){
	var el = top.document.getElementById(id);
	el.style.display = "block";
	return false;			
	}
}
//--------------------------------------------------------------->
function visible(id) {
	if(document.getElementById){
	var el = top.document.getElementById(id);
	el.style.visibility = "visible";
	return false;			
	}
}
function hidden(id) {
	if(document.getElementById){
	var el = top.document.getElementById(id);
	el.style.visibility = "hidden";
	return false;			
	}
}
//--------------------------------------------------------------->
function visTog_alt(id)
{
	if(document.getElementById)
	{
	var div = document.getElementById(id);
		if(div.style.display == "none")
			{
			div.style.display = "block";
			}
		else if(div.style.display == "block")
			{
			div.style.display = "none";
			}
		else
		{
		return false;
		}
	}
}

function visTog(obj) 
{
	if(document.getElementById)
	{
	var divs = document.getElementsByTagName("div");

		if(divs[obj].style.display == "none")
			{
			divs[obj].style.display = "block";
			}
		else if(divs[obj].style.display == "block")
			{
			divs[obj].style.display = "none";
			}
		else
			{
			return false;
			}
	}
}

function visTogGroup()
{
	if (document.getElementById)
	{

     	divs = new Array ("readMore", "colR2hiddenBox");
		var div1 = top.document.getElementById("readMore");
		var div2 = top.document.getElementById("colR2hiddenBox");
		
		for(i=1;i<=divs.length;i++)
		{
			if(eval("div"+i).style.display == "none")
			{
			eval("div"+i).style.display = "block";
			}

			else if(eval("div"+i).style.display == "block")
			{
			eval("div"+i).style.display = "none";
			}

			else
			{
			return false;
			}
		}
	}
}
//--------------------------------------------------------------->
function setZIndex(id, zIndex) 
{
     if (document.getElementById)
	{
	var div = top.document.getElementById(id);
     div.style.zIndex = zIndex;
	}
}
//--------------------------------------------------------------->
function changeFrame(framename1,url1) {
	top[framename1].location.href = url1;
}
//--------------------------------------------------------------->
function changeFrames(framename1,url1,framename2,url2) {
     top[framename1].location.href = url1;
	top[framename2].location.href = url2;
}
//--------------------------------------------------------------->
function changeHTML(id,content) {
	if(document.getElementById){
		document.getElementById(id).innerHTML = ""; 
		document.getElementById(id).innerHTML = content; 
	}
}
//--------------------------------------------------------------->
function topchangeHTML(id,content) {
	if(document.getElementById){
		top.document.getElementById(id).innerHTML = ""; 
		top.document.getElementById(id).innerHTML = content; 
	}
}
//--------------------------------------------------------------->

function pulldownLaunch (pulldown) {
	newlocation = pulldown[pulldown.selectedIndex].value;
	if(newlocation != "")
		window.open(newlocation);
}
//--------------------------------------------------------------->
function resetIfBlank (pulldown) {
	possiblenewlocation = pulldown[pulldown.selectedIndex].value;
	if(possiblenewlocation == "")
		pulldown.selectedIndex = 0;
}
//--------------------------------------------------------------->
function pulldownNewPage() {
var listItem = document.menuForm.newPage.selectedIndex;

var newPage = document.menuForm.newPage.options[listItem].value;
location.href = newPage;
}
//--------------------------------------------------------------->
function switchMenu(obj) {
	var el = document.getElementById(obj);
	if ( el.style.display != "none" ) {
		el.style.display = 'none';
	}
	else {
		el.style.display = '';
	}
}