// JavaScript Document



var agt=navigator.userAgent.toLowerCase();
var ie = false
var ffShadowOffset = 0;
var lastLinkId="about";

if (agt.indexOf("msie") > -1) { ie = true; }


if (!ie){
		
		ffShadowOffset = 0;
	
	}


window.onresize = windowresizeevent;	

function init(){

    setlnkImg();

    windowresizeevent();

    try{
    
        if (page == "contact.asp") {

            window.setTimeout("bottomHeightSize()", 200);
        }
        else {
        
            bottomHeightSize();
        }
        
    }
    catch(e){
            
            window.setTimeout("bottomHeightSize()", 200);
        }
    
    
}



function bottomHeightSize() {
    
    var tc = new Obj_rectangle(document.getElementById("topContainer"));

    var windowHeight = alertSize()[1];

    if (tc.ObjHeight + 190 < windowHeight) {
    
        var diff = windowHeight - tc.ObjHeight - 220;

        var bottomBannerTDspace = document.getElementById("bottomBannerTDspace");

        if (page != "contact_e.asp") {

            bottomBannerTDspace.style.height = diff + "px";
        }
    }

}


var movement = function(obj_id) {

    this.id = obj_id;
    this.inprogress = false;
}

var tArr = new Array();

tArr['lnk_ksilophon']   = new movement('lnk_ksilophon');
tArr['lnk_drum']        = new movement('lnk_drum');
tArr['lnk_noiser']      = new movement('lnk_noiser');
tArr['lnk_jar']         = new movement('lnk_jar');
tArr['lnk_tofmiriam']   = new movement('lnk_tofmiriam');
tArr['lnk_elefant']     = new movement('lnk_elefant');


function windowresizeevent(){

    var i = 0; 
    
    for (var t in tArr) {
        
        i += 100; 
        
        window.setTimeout("mouseOver('" + tArr[t].id + "')", i);
    }



    if (page == "catalogItems.asp") {

        JSFX_FloatDiv("divTopLeft", 10, 30).floatIt();
    }



}


function setlnkImg() {
    
    var spans = document.getElementsByTagName("span");
    
    for (var t=0; t<spans.length; t++){
        if (spans[t].className == "lnk-img-span"){
            spans[t].style.visibility = "visible";
        }
    }
}


function catNameOut(obj) {

    obj.style.fontWeight = "400";
}

function catNameOver(obj) {

    obj.style.fontWeight = "700";
}

function mouseOver(id) {

    //document.getElementById(id + "_arrow").src = "images/double-left-arrow.png";

    document.getElementById(id).style.visibility = "visible";

    if (tArr[id].inprogress == false && document.getElementById(id).style.top == "-10px") {
        tArr[id].inprogress = true;

        $("#" + id).animate({
            "top": "-=10px"
        }, "fast", function() {
            //animation complete
            document.getElementById(id).style.top = "-20px";
        });

        $("#" + id).animate({
            "top": "+=10px"
        }, "fast", function() {
            //animation complete
            document.getElementById(id).style.top = "-10px";
            tArr[id].inprogress = false;
        });
        
    }   
}

function mouseOut(id) {

    //document.getElementById(id + "_arrow").src = "images/lnk_arrow.png";
}






function resizeEvent() {

    ffShadowOffset = 0;

}


function Obj_rectangle(Obj)
{
	if (! Obj){return;};

	this.ObjLeft = findOffset(Obj, "offsetLeft");
	this.ObjWidth = Obj.offsetWidth;
	this.ObjRight = this.ObjLeft + this.ObjWidth;
	this.ObjTop = findOffset(Obj, "offsetTop");
	this.ObjHeight = Obj.offsetHeight;
	this.ObjBottom = this.ObjTop + this.ObjHeight;

	function findOffset(Obj, offset)
	{
		var NumValue = 0;
		
		var startOffsetDom = Obj;

		while (startOffsetDom.offsetParent)
		{
			NumValue = NumValue + startOffsetDom[offset];
			startOffsetDom = startOffsetDom.offsetParent;
		}
		return NumValue;
	}
}




    function alertSize() {
      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;
      }
      
      return [myWidth,myHeight] 
    } 
