﻿function getObj(id) {
	if(document.all) {
		return document.all[id];
	} else if(document.getElementById) {
		return document.getElementById(id);
	} else if(document.layers) {
		return document.layers[id];
	} else {
		alert('This browser doesn\'t support "document.all", "document.layers", or "document.getElementById".');
		return null;
	}
} 

function popUp(URL) {
    alert(URL);
    day = new Date();
    id = day.getTime();
    eval("page" + id + " = window.open('" + URL + "', '" + id + "', 'toolbar=0,scrollbars=0,location=0,statusbar=1,menubar=0,resizable=1,width=500,height=500,left = 390,top = 150');");
}

/*ie6 png fix*/
var arVersion;
var version;

if(navigator.appName.indexOf("Microsoft")!= -1){
    //alert("windows");
    arVersion = navigator.appVersion.split("MSIE");
    version = parseFloat(arVersion[1]);
}

function SetShadowPNG(myImage, container) 
{
    if ((version >= 5.5) && (version < 7) && (document.body.filters)) 
    {
       var imgID = (myImage.id) ? "id='" + myImage.id + "' " : ""
	   var imgClass = (myImage.className) ? "class='" + myImage.className + "' " : ""
	   var imgTitle = (myImage.title) ? 
		             "title='" + myImage.title  + "' " : "title='" + myImage.alt + "' "
	   var imgStyle = "display:inline-block;" + myImage.style.cssText
	   var height = myImage.height
	   var strNewHTML = "<span " + imgID + imgClass + imgTitle
                  + " style=\"" + "width:" + myImage.width + "; height:" + height + " !important;" + imgStyle + ";"
                  + "filter:progid:DXImageTransform.Microsoft.AlphaImageLoader";
       strNewHTML += "(src=\'" + myImage.src + "\', sizingMethod='scale');\">";      
       strNewHTML += "</span>";
	   getObj(container).innerHTML = strNewHTML;
    }
}

/*drop menu for archive*/
function toggleMenu(name)
{
	var obj = getObj('menu_' + name);
	var pic = getObj('arrow_' + name);

    if(obj.style.display == 'block')
	{
		obj.style.display = 'none';
		pic.setAttribute("src", "media/images/arrow_closed.gif");
	}
	else
	{
		obj.style.display = 'block';
		pic.setAttribute("src", "media/images/arrow.gif");
	}
}

var display = "";
function subOptions(elem){
	var list = getObj("current_feature_subitem_box");
	var parent = getObj("contextP");
	
	if(display == ""){
		parent.style.borderBottom = "none";
		parent.setAttribute("class", "current_feature_itemContext1");
		list.style.display = "block";
		display = "shown";
	}else{
		parent.style.borderBottom = "1px solid #BEBB90";
		parent.setAttribute("class", "current_feature_itemContext");
		list.style.display = "none";
		display = "";
	}
}

function ShowImage(img)
{
    getObj('FullImage').src = img;
}

function ChangeSite()
{
    location.href = getObj('siteList').value;
}

function setBack(){
	display = "";
	/*var parent = getObj("contextP");
	parent.style.borderBottom = "1px solid #BEBB90";
	parent.setAttribute("class", "current_feature_itemContext");*/
}


	var rotCount = 0;
	var current = 1;

$(document).ready(function()
{
	//$(".rotator").each(function()
	//{
	//	var id = $(this).attr("id").substring(7);
	//	var count = 0;
	//		$(".rot" + id).each(function()
	//		{
	//		});
	//});

	var timer;
	timer = setInterval('swapImage()',5000);
});
var cur = 0;
function swapImage()
{
	//if (current == rotCount)
	//{
	//	current = 1;
	//}
//	else
//	{
//		current = current + 1;
//	}

	$(".rotator").each(function()
	{
		var id = $(this).attr("id").substring(7);
		if ($("#container" + id).css("visibility") == "visible")
		{
		var count = 0;
		$(".rot" + id).each(function()
			{
			count++;
			});
			$(".rot" + id).each(function()
			{
				if ($(this).hasClass("currentRot"))
				{
					cur = $(this).attr("id").substring(3);
					$(this).css("display","none");
				} 
			});
			$(".rot" + id + "#rot" + cur).removeClass("currentRot");
				
						cur++;
					if (cur == count+1)
					{
						cur = 1;
					} 
					$(".rot" + id + "#rot" + cur).addClass("currentRot");
					$(".rot" + id + "#rot" + cur).css("display","block");
					
		}
	});
	
}
