/******************************************************************************
Filename:  universal.js
Project:   Grandover
Purpose:   Universal:  universal javascript function and varibles
Date			Developer	Description
04/01/2008		css			Version 1.0
******************************************************************************/


/******************************************************************************
	Global Control Variables
******************************************************************************/
var hasReqestedVersion = false;
//var pageTracker = _gat._getTracker("UA-684767-1");
// alert("pageTracker has been created")	
/******************************************************************************
	Global Functions
******************************************************************************/
function jsEnabled()
{
	//document.write('<style type="text/css"> #content a.jsEnabled{display:inline; } </style>');
	document.write('<style type="text/css"> a.jsEnabled{display:inline; } </style>');
}

function processAnchor(anchorElement, url, target)
{
	//alert(url);
	if(target == '_blank' && !hasReqestedVersion)
	//if(target == '_blank')
	{	window.focus();
		window.open(url);  
	}
	else getFlashObject('flashPlayer').processURLBrowser(url, target);
}

function printPage()
{
	//alert("You Printed a Page: \n"+arguments[0]);
	
	//if(redirect=="f" && arguments.length<1)
	//{
		print();	
	//}
}

function redirectPage(){
	if (!special){
		var special = "t";
	}
	if (!hasReqestedVersion && redirect=="f" && special!=="t")
	{
		var url = window.location.href;
		url = url.split('/')[2];
		//document.write(url);
		var home = "indexStatic.asp"; // this variable needs to be changed for other sites
		window.location.replace("http://"+url+"/"+home);
	}
	else if(hasReqestedVersion && redirect=="t") 
	{
		// output redirection 
		var href = window.location.pathname;
		var url = window.location.href;
		var urlL = url.length;
		var hrefL = href.length;
		var magicNumber = urlL - hrefL;
		
		url = url.split('/')[2];
		href = href.split('.')[0];
		href = href.slice(1);
		if(href =="") href="index";
		href = "#"+ href;
		
		window.location.replace("http://"+url+"/"+href);
	}	
	else 
	{
		// load static version 
		//alert("Calling seoTracker() ");
		//seoPageTracker();
	}

}

function fadeGroup(){
 for(var i=1; i<arguments.length; i++)
 {
   var element = document.getElementById(arguments[i]);
   element.style.filter = 'alpha(opacity=' + arguments[0]*10 + ')';
   element.style.opacity = arguments[0]/10;
  }
}


function fade(newOpacity, element){
 
 if(arguments.length>1){
 	element.style.filter = 'alpha(opacity=' + newOpacity*10 + ')';
   	element.style.opacity = newOpacity/10;
  }
}

function getFlashObject(movieName) {
    if (navigator.appName.indexOf("Microsoft") != -1) {
        return window[movieName];
    }
    else {
        return document[movieName];
    }
}


/******************************************************************************
	Intial Function Calls
******************************************************************************/
jsEnabled();

with (unFocus.Flash) {
		if (Player.getVersion() >= 8)
		hasReqestedVersion = true;
		redirectPage();
}

