﻿$(document).ready(function() {
if (document.images) 
{
   img7 = new Image();
   img8 = new Image();
   img9 = new Image();
   img10 = new Image();
   img11 = new Image();
   img7.src = "media/images/common/navigation/navigation_on_left.jpg";
   img8.src = "media/images/common/navigation/navigation_on_right.jpg";
   img9.src = "media/images/common/navigation/navigation_on_middle.jpg";
   img10.src = "media/images/common/navigation/dropdown_bottom.png";
   img11.src = "media/images/common/navigation/dropdown.png";
}

    $("#fonttoggle").toggle(function(){	
		$("#fontsize").css("display", "block");
		}, function() 
	{
		$("#fontsize").css("display", "none");
    });

        $("li.navItem").hover(function(){	
		var name = $(this).attr("name");		
		$(this).css("zIndex", "9999");		
        $("#" + name + "ItemContainer").css("display", "block");
        var name = $(this).attr("name");
		$("#" + name + "left").attr("class", "navonleft");
		var name = $(this).attr("name");
		$("#" + name + "right").attr("class", "navonright");
		var name = $(this).attr("name");
		$("#" + name + "middle").attr("class", "navon");
       }, function()
	{
        var name = $(this).attr("name");
        $("#" + name + "ItemContainer").css("display", "none");
        $(this).css("zIndex", "1");
        $("#" + name + "left").attr("class", "navoffleft");
        var name = $(this).attr("name");
		$("#" + name + "right").attr("class", "navoffright");
		var name = $(this).attr("name");
		$("#" + name + "middle").attr("class", "navoff");
    });
});


function popUp(URL) 
{
    day = new Date();
    id = day.getTime();
    eval("page" + id + " = window.open(URL, '" + id + "', 'toolbar=0,scrollbars=0,location=0,statusbar=0,menubar=0,resizable=0,width=350px,height=400px,left = 400px,top = 200px');");
}

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;
	}
} 



var arVersion = navigator.appVersion.split("MSIE")
var version = parseFloat(arVersion[1])

if (version >= 5.5) 
{
   for(var i=0; i<document.images.length; i++)
   {
      var img = document.images[i]
      var imgName = img.src.toUpperCase()
      if (imgName.substring(imgName.length-3, imgName.length) == "PNG")
      {
         var imgID = (img.id) ? "id='" + img.id + "' " : ""
         var imgClass = (img.className) ? "class='" + img.className + "' " : ""
         var imgTitle = (img.title) ? "title='" + img.title + "' " : "title='" + img.alt + "' "
         var imgStyle = "display:inline-block;" + img.style.cssText 
         if (img.align == "left") imgStyle = "float:left;" + imgStyle
         if (img.align == "right") imgStyle = "float:right;" + imgStyle
         if (img.parentElement.href) imgStyle = "cursor:hand;" + imgStyle
         var strNewHTML = "<span " + imgID + imgClass + imgTitle
         + " style=\"" + "width:" + img.width + "px; height:" + img.height + "px;" + imgStyle + ";"
         + "filter:progid:DXImageTransform.Microsoft.AlphaImageLoader"
         + "(src=\'" + img.src + "\', sizingMethod='scale');\"></span>" 
         img.outerHTML = strNewHTML
         i = i-1
      }
   }
}

/*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 setBack(){
	display = "";
	/*var parent = getObj("contextP");
	parent.style.borderBottom = "1px solid #BEBB90";
	parent.setAttribute("class", "current_feature_itemContext");*/
}
	
//var lint = 0;

function RotateSet()
{
    try
    {
    	getObj("forhope").style.display = 'block';
		getObj('msg_hope_off').style.color = '#A50A37';
		getObj('msg_hope_off').style.background = 'url(../media/images/default/msg/hope_on.jpg) no-repeat';
		getObj('hopepng').style.display = 'block';
		getObj('lifepng').style.display = 'none';
		getObj('strengthpng').style.display = 'none';
		RotateAnchors();
		getObj('asplash').style.display = 'block';
		// the timeout value should be the same as in the "refresh" meta-tag
		//if (lint <= 1)
		//{
		//	setInterval('refresh()', 4000);
		//	lint++;
		//}
		setInterval('RotateAnchors()', 5000);
	}
    catch (err)
    {
		
    }
}

function doLoad()
{
    
}
function refresh()
{
    //  This version does NOT cause an entry in the browser's
    //  page view history.  Most browsers will always retrieve
    //  the document from the web-server whether it is already
    //  in the browsers page-cache or not.
    //
    window.location.reload();
}

function RotateAnchors()
{
    var index = getObj('index').value;
    var msgs = 'hope,strength,life';
    var array = msgs.split(",");
    var current = array[index];
         
    for(i=0;i<array.length;i++) {
        getObj('msg_' + array[i] + '_off').style.color = '#34497A';
        getObj('msg_' + array[i] + '_off').style.background = 'url(../media/images/default/msg/' + array[i] + '_off.jpg) no-repeat';
        /*(function($) {
            $(getObj('for' + array[i])).fadeOut("slow");
        })(jQuery);*/
        getObj('for' + array[i]).style.display = 'none';
        getObj(array[i] + 'png').style.display = 'none';
        getObj('blankdiv').style.background = 'Transparent';
    }
    /*getObj('for' + current).style.display = 'block';*/
    (function($) {
        $(getObj('for' + current)).fadeIn("slow");
    })(jQuery);
    getObj('msg_' + current + '_off').style.color = '#A50A37';
    getObj('msg_' + current + '_off').style.background = 'url(../media/images/default/msg/' + current + '_on.jpg) no-repeat';
    getObj(current + 'png').style.display = 'block';
    index++;
    if (index >= array.length)
    {
        index = 0;
    }
    getObj('index').value = index;
}