﻿// initialize the history plugin

if(ajaxMode){
	updateHash();
}

try{
    $("#cornerImage").load(function () {
        showImage();
    });

    if($("#cornerImage")[0].complete){
        showImage();
    }
}
catch(err)
{
}


$(document).ready(function() {
    $(document).pngFix(); 
    

    // render callouts
	$("a[@class='callout']").unbind("mouseenter").bind('mouseenter',function(){
	    showCallout(this);
	});
	
    // render popups
	$("a[@class='popup']").unbind("click").bind('click',function(){
	    return showPopup(this);
	});
	
	// render accordian views
	$("ul[@class='accordion']").each(function(){
	    $(this).accordion({
	        active: '.selected',
	        header: "a[href*=#]:not(a[contentId])",
	        clearStyle: true,
	        autoHeight: false,
	        alwaysOpen: false
	    });
	})
});

// HELPER FUNCTIONS

function setOpacity(obj, opacity) {
  opacity = (opacity == 100)?99.999:opacity;
  // IE/Win
  obj.style.filter = "alpha(opacity:"+opacity+")";
  // Safari<1.2, Konqueror
  obj.style.KHTMLOpacity = opacity/100;
  // Older Mozilla and Firefox
  obj.style.MozOpacity = opacity/100;
  // Safari 1.2, newer Firefox and Mozilla, CSS3
  obj.style.opacity = opacity/100;
}

function fadeIn(objId,opacity) {
  if (document.getElementById) {
    obj = document.getElementById(objId);
    if (opacity <= 100) {
      setOpacity(obj, opacity);
      opacity += 10;
      window.setTimeout("fadeIn('"+objId+"',"+opacity+")", 20);
    }
  }
}

function showImage()
{
    image = document.getElementById("cornerImage");
    setOpacity(image, 0);
    $("#cornerImage").css('visibility', 'visible')
    fadeIn("cornerImage", 0);
}