/*global.js*/

window.onload = function(){
	setTargetBlank();
}


//--------------------------------------------------------------------------------------------------

//Browser Detection/Redirection
detect();
function detect(){
	var userAgent = navigator.userAgent;
	//Target IE 5.0, IE 5.5, NN 7.x
	if(userAgent.indexOf("MSIE 5.0") != -1 || userAgent.indexOf("MSIE 5.5") != -1 || userAgent.indexOf("Netscape/7") != -1 ){
		location.href = "upgrade/";
	}
}

//--------------------------------------------------------------------------------------------------
			
function addLoadEvent(func) {
	var oldonload = window.onload;
	if (typeof window.onload != 'function') {
		window.onload = func;
	} else {
		window.onload = function() {
			if (oldonload) {
				oldonload();
			}
			func();
		}
	}
}

//--------------------------------------------------------------------------------------------------

//standards-compliant target="_blank" functionality
function setTargetBlank() {
	if (document.getElementsByTagName){
		var arrAnchors = document.getElementsByTagName("a");
		for (var i=0; i<arrAnchors.length; i++) {
			var anchor = arrAnchors[i];
			if (anchor.getAttribute("href") && anchor.getAttribute("rel") == "blank"){
				anchor.target = "_blank";
			}
		}
	}
}

//--------------------------------------------------------------------------------------------------

//ie6 transparency hack
function png_fix(id){

	browser = navigator.userAgent;
	if(browser.indexOf("MSIE 6") != -1){
		//page photo
		document.getElementById("page-photo-" + id).style.background = "none";
		document.getElementById("page-photo-" + id).style.filter = "progid:DXImageTransform.Microsoft.AlphaImageLoader(src='images/page_photo_" + id + ".png')";
		//page title
		if(id != 0){
			document.getElementById("page-title-" + id).style.background = "none";
			document.getElementById("page-title-" + id).style.filter = "progid:DXImageTransform.Microsoft.AlphaImageLoader(src='images/page_title_" + id + ".png')"
		}
	}
	
}