﻿// JScript File
if(typeof(jHome) == "undefined")
{
    var jHome = {
        preloadFlag : false,
        init_done   : false,
        wishlistText : "Click on this link to show your wish list items.",
        
        initPage : function() {
            if(jHome.init_done) return;
        },
        
        newImage : function(arg) {
            if (document.images) {
		        rslt = new Image();
		        rslt.src = arg;
		        return rslt;
	        }
        },
        
        changeImages : function(imgname, sourcefile)
        {
            var obj = null;
            obj = document.getElementById(imgname);
            if(obj != null) obj.src = sourcefile;
	    },
	    
	    changeColor : function(name, color)
        {
            var obj = null;
            obj = document.getElementById(name);
            if(obj != null) obj.color = color;
	    },
    	
	    preloadImages : function()
	    {
	        if (!jHome.preloadFlag) {
	            home_over    = jHome.newImage("images/header/header_SC_02-over.gif");
		        about_over   = jHome.newImage("images/header/header_SC_03-over.gif");
		        info_over    = jHome.newImage("images/header/header_SC_04-over.gif");
		        contact_over = jHome.newImage("images/header/header_SC_05-over.gif");
		        jHome.preloadFlag = true;
		    }
	    },
	    
	    syncWishListCount : function()
	    {
	        var obj1 = null;
	        var obj2 = null;
	        // Update the WishCnt value only when frames are active
	        if (window.frames.parent.frames["head"] != null)
	            obj1 = window.frames.parent.frames["head"].document.getElementById("WishCnt");
	        obj2 = document.getElementById("WishListCount");
	        if (obj1 != null && obj2 != null) {
	           obj1.innerHTML = obj2.value;
	        }
	    },
	    
	    WishListComments : function()
	    {
	        var wishlist = document.getElementById("hidWishList").value;
	        var wlist = new Array();
	        var wlist = wishlist.split(",");
	        var sreturn = "";
	        
	        if (wishlist == "")
	            return "";
	        
	        for(var i=0; i<wlist.length; i++) {
	            sreturn = sreturn.concat(wlist[i] + "=" + document.getElementById("q"+wlist[i]).value + "|");
	        }
	        document.getElementById("hidComments").value = sreturn;
	    }
    };	    
}

