// JavaScript Document
function close_popup()
{
	popupbox = document.getElementById("popup");
	popupbox.style.display='none';
	popupbox.style.opacity = 0;
	//popupbox.style.filter='alpha(opacity=0)';
}

var num = 0;
function appear_box() {
	num = 0;
	popupbox = document.getElementById("popup");
	popupbox.style.display = 'block';
	
	//for centering popup in screen
	//get center point
	var myWidth = 0, myHeight = 0;
	if( typeof( window.innerWidth ) == 'number' ) {
		//Non-IE
		myWidth = window.innerWidth;
		myHeight = window.innerHeight;
	} else if( document.documentElement && ( document.documentElement.clientWidth || document.documentElement.clientHeight ) ) {
		//IE 6+ in 'standards compliant mode'
		myWidth = document.documentElement.clientWidth;
		myHeight = document.documentElement.clientHeight;
	} else if( document.body && ( document.body.clientWidth || document.body.clientHeight ) ) {
		//IE 4 compatible
		myWidth = document.body.clientWidth;
		myHeight = document.body.clientHeight;
	}
	var my_x=((myWidth/2)-354);
	
	popupbox.style.left = my_x+'px';
	popupbox.style.top = '50px';

setIntDn = setInterval("dissolve_in()",15);

}
	
function dissolve_in(){
	popupbox.style.opacity = num/100;
	//popupbox.style.filter='alpha(opacity='+num+')';
	if(num < 110){num=num+15;}
	else{clearInterval(setIntDn);}
}
		
//function to initialize popup
startList = function() {

		//get element reference to give active thumb border
		navRoot = document.getElementById("popup_thumbs");
		
		if (!navRoot) return;
		//detect browser and get refs for child nodes
		var browser=navigator.appName
		var b_version=navigator.appVersion
		var version=parseFloat(b_version)
		if ((browser=="Microsoft Internet Explorer") && (version>=4))
			{
				//ie
				node0 = navRoot.childNodes[0];
				node1 = navRoot.childNodes[1];
				node2 = navRoot.childNodes[2];
				node3 = navRoot.childNodes[3];
			}
			else
			{
				//mozilla, safari, netscape
				node0 = navRoot.childNodes[1];
				node1 = navRoot.childNodes[3];
				node2 = navRoot.childNodes[5];
				node3 = navRoot.childNodes[7];
			}
		
		//------node0.style.border='1px solid #ccc';
		
		//Initialze making first thumb hightlighted
		node0.className="thumb1 over";
		
		//for loop for checking which thumb is clicked and apply border
		for (i=0; i<navRoot.childNodes.length; i++)
			{
				node = navRoot.childNodes[i];
				if (node.nodeName=="LI")
				{
					node.onmousedown=function()
					{
						for (j=0; j<navRoot.childNodes.length+10; j++)
							{
								mynode = (eval("node"+j));
								mynode.className = "thumb"+(j+1);
								this.className+=" over";
								var clicked = this;
							}
					}
				}
		}
}
window.onload=startList;

//function to change enlarge pic while thumb is clicked
function change_pic(img_path) {
		my_image = new Image();
		my_image.src  = img_path;
		if (document.images)
		{
			document.images['enlarge-pic'].src = my_image.src;
		}
}

//function for logos

function swap_logo(logo_name, num)
{
	logo_thumb = document.getElementById("logothumb"+num);
	var my_url = 'url(images/logos/'+logo_name+') right top no-repeat';
	logo_thumb.style.background = my_url;
}

function restore_logo(logo_name, num)
{
	logo_thumb = document.getElementById("logothumb"+num);
	var my_url = 'url(images/logos/'+logo_name+') left top no-repeat';
	logo_thumb.style.background = my_url;
}