/********************
GENERAL FUNCTIONS
*********************/

//--Get css info --//
function getStyle(oElm, strCssRule){
    var strValue = "";
    if(document.defaultView && document.defaultView.getComputedStyle){
        strValue = document.defaultView.getComputedStyle(oElm, "").getPropertyValue(strCssRule);
    }
    else if(oElm.currentStyle){
        strCssRule = strCssRule.replace(/\-(\w)/g, function (strMatch, p1){
            return p1.toUpperCase();
        });
        strValue = oElm.currentStyle[strCssRule];
    }
    return strValue;
}
//-- Build Flash --//
function buildFlash (divId, swfLoc, swfName, swfHeight, swfWidth, swfVar, swfVar2){
		var flashVersion = 8;
		var so = new SWFObject(swfLoc, swfName, swfWidth, swfHeight, flashVersion, "#FFFFFF");
		//so.addParam("wmode", "transparent");
		so.addParam("scale", "noscale");
		if (swfVar){
			so.addVariable("v1", swfVar);
		}
		if (swfVar2){
			so.addVariable("v2", swfVar2);
		}
		so.write(divId);
}
function hideLogo (){
document.getElementById('viewlogo').style.display = "none";	
}
//-- Show/Hide functions --//
//-- Show/Hide functions --//
function hideAll(lyrId) { 
	var divs = document.getElementsByTagName('div'); 
	for(i=0;i<divs.length;i++){ 
		if(divs[i].id.match(lyrId)){
		//alert(lyrId)
			divs[i].style.display='none';
		} 
	} 
}

function showHide(nr) {

    current = (document.getElementById(nr).style.display == 'block') ? 'none' : 'block';
    document.getElementById(nr).style.display = current;
}


//-- Swap Image --//
var currentImage;
function changeImage(imageName, newSrc){
	if (selectedImage != imageName){
		var iName = document.getElementsByName(imageName);
		currentImage = newSrc;
		iName[0].src = newSrc;
	}
}
//-- Set Cookie --//
function setCookie(cookieName,cookieValue) {
	//alert("setting: " + cookieName + " with: " +cookieValue )
	var path = "/";
	
	document.cookie = cookieName+"="+escape(cookieValue) + ";path=" + path + ";";
}

var z = 4;
function fadein(div) {

	var k = document.getElementById(div).style;
	var x = z-1
	

	//alert("this z-index:" + k.zIndex + "\n counter:" + x);

	if(k.zIndex != x){
		k.display = "none";
	//	k.visibility = "hidden";

		k.zIndex = z;
		setTimeout("Effect.Appear('"+ div+"', {duration: 0.5});", 150);
		
		var anchorlink = document.getElementsByTagName('a'); 
		
		for(i=0;i<anchorlink.length;i++){ 
			if(anchorlink[i].id.match("but-")){
				anchorlink[i].style.background = "#fff url(/common/images/screen-button.gif) no-repeat";
				anchorlink[i].style.color = "#424242";
			}
		}
		
		
		document.getElementById("but-" + div).style.background = "#fff url(/common/images/screen-selected.gif) no-repeat";
		document.getElementById("but-" + div).style.color = "#0093c7";
		
		//Effect.Appear(div);
		z++;
	//	document.getElementById("testCounter").innerHTML = "count = " + z;
	//	alert("z-index" + z);
	}
	//return false;
}

function fadeout(div) {
	var k = document.getElementById(div).style;
	var x = z-1
	

	//alert("this z-index:" + k.zIndex + "\n counter:" + x);

	//if(k.zIndex = x){
	//	k.display = "none";
	//	k.visibility = "hidden";

		//k.zIndex = z;
		setTimeout("Effect.Fade('"+ div+"');", 50);
		//Effect.Fade(div);
		//z++;
	//	document.getElementById("testCounter").innerHTML = "count = " + z;
	//	alert("z-index" + z);
	//}

}