// Credits to www.brainerror.net for providing parts of the opacity script, modified by moi /


// For those who happen to be snooking around here:
// Yes I know, the scripts made below are pretty n00bish...
// But thats how you save time ;)



//Start of opacity script /
function opacity(id, opacStart, opacEnd, millisec) {
	//speed for each frame
	var speed = Math.round(millisec / 100);
	var timer = 0;

	//determine the direction for the blending, if start and end are the same nothing happens
	if(opacStart > opacEnd) {
		for(i = opacStart; i >= opacEnd; i--) {
			setTimeout("changeOpac(" + i + ",'" + id + "')",(timer * speed));
			timer++;
		}
	} else if(opacStart < opacEnd) {
		for(i = opacStart; i <= opacEnd; i++)
			{
			setTimeout("changeOpac(" + i + ",'" + id + "')",(timer * speed));
			timer++;
		}
	}
}

//change the opacity for different browsers
function changeOpac(opacity, id) {
	var object = document.getElementById(id).style; 
	object.opacity = (opacity / 100);
	object.MozOpacity = (opacity / 100);
	object.KhtmlOpacity = (opacity / 100);
	object.filter = "alpha(opacity=" + opacity + ")";
}

function show(id, millisec) {
	//show element
	document.getElementById(id) 
		currentOpac(id, 100, millisec); 
		
	// sets z-index
	document.getElementById(id).style.zIndex = 30;

	// sets visibility to visible
	document.getElementById(id).style.display='block';
}

function hide(id2, id3, id4, id5) {
	//hide elements
	document.getElementById(id2) 
		currentOpac(id2, 0, 300); 
				
	document.getElementById(id3) 
		currentOpac(id3, 0, 300); 
		
	document.getElementById(id4) 
		currentOpac(id4, 0, 300); 	
	
	document.getElementById(id5) 
	currentOpac(id5, 0, 300); 	

	// sets z-index
	document.getElementById(id2).style.zIndex = 20;
	
	document.getElementById(id3).style.zIndex = 20;
	
	document.getElementById(id4).style.zIndex = 20;
	
	document.getElementById(id5).style.zIndex = 20;
	
	// sets visibility to hidden
	document.getElementById(id2).style.display='none';
	document.getElementById(id3).style.display='none';
	document.getElementById(id4).style.display='none';
	document.getElementById(id5).style.display='none';
}

function currentOpac(id, opacEnd, millisec) {
	//standard opacity is 100
	var currentOpac = 100;
	
	//if the element has an opacity set, get it
	if(document.getElementById(id).style.opacity < 100) {
		currentOpac = document.getElementById(id).style.opacity * 100;
	}

	//call for the function that changes the opacity
	opacity(id, currentOpac, opacEnd, millisec)
}
//End of opacity script /

//Start of new window script /

function WinPopup()
{
	winName = "New";
	width = "500px";
	height = "500px";
	scrollbars = "no";
	resizable = "no";
	var argv = WinPopup.arguments;
	var i_length = argv.length;
	if (i_length > 0) {
		url = argv[0];
	}
	if (i_length > 1) {
		winName = argv[1];
	}
	if (i_length > 2) {
		width = argv[2];
	}
	if (i_length > 3) {
		height = argv[3];
	}
	if (i_length > 4) {
		scrollbars = argv[4];
	}
	if (i_length > 5) {
		resizable = argv[5];
	}
    winRef = window.open(url,winName,"toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=" + scrollbars + ",resizable=" + resizable + ",copyhistory=yes,width=" + width + ",height=" + height + ",top=" + (screen.availHeight - 500) / 2 + ",left=" + (screen.availWidth - 600) / 2);
    winRef.focus();
}

//End of new window script /

