jQuery.noConflict(); //alert("test");// JavaScript Document

jQuery(document).ready(function(){


    
/*preload images*/
/*kindly add all of the images, required to be preloaded, in the list below*/    
        jQuery.preLoadImages(['/static/common/images/newsite/header-logo.gif', '/static/common/images/newsite/header-call-4money-4.jpg', '/static/common/images/newsite/recos/ml-bg.jpg', '/static/common/images/newsite/recos/ml-br.jpg', '/static/common/images/newsite/recos/ml-bsun.jpg', '/static/common/images/newsite/recos/ml-christian.jpg', '/static/common/images/newsite/recos/ml-motleyfool.jpg', '/static/common/images/newsite/recos/ml-kiplinger.jpg', '/static/common/images/newsite/recos/ml-hew.jpg', '/static/common/images/newsite/recos/ml-ct.jpg', '/static/common/images/newsite/recos/ml-cnnmoney.jpg', '/static/common/images/newsite/recos/ml-npr.jpg', '/static/common/images/newsite/recos/ml-oaktrib.jpg', '/static/common/images/newsite/recos/ml-times.jpg', '/static/common/images/newsite/recos/ml-wsj.jpg', '/static/common/images/newsite/recos/recos.jpg'], function(){
            //alert("All Passed Images and All CSS Images Loaded");
        });
        
        
/*script to load logo in header*/
        var loadLogoImg = new Image();
        jQuery(loadLogoImg).load(function(){
            jQuery(this).hide();
            jQuery('#ggf-logo').append(this);
            jQuery(this).fadeIn(1000);
        }).attr('src', '/static/common/images/newsite/header-logo.gif');
        
/*script to load contact no. in header*/
        /*var loadCallImg = new Image();
         jQuery(loadCallImg).load(function () {
         jQuery(this).hide();
         jQuery('#ggf-call').append(this);
         jQuery(this).fadeIn(1000);
         }).attr('src', '/static/common/images/newsite/header-call-4money-4.jpg');*/
        /* navigation related*/
        jQuery('#nav a').css({
            backgroundPosition: "0 0"
        }).mouseover(function(){
            jQuery(this).stop().animate({
                backgroundPosition: "(0 -32px)"
            }, {
                duration: 200
            })
        }).mouseout(function(){
            jQuery(this).stop().animate({
                backgroundPosition: "(0 0)"
            }, {
                duration: 500
            })
        });
        
		/*this one works for ie7 - in keeping the current tab in yellow-orange*/
        jQuery('#nav a').css({
            backgroundPosition: "0 0"
        })
        /*.mouseup(function(){
         jQuery(this).({backgroundPosition:"(0 -32px)"}, {duration:200})
         });*/

/* text resizing related */
       
        
        // Reset Font Size
        var originalFontSize = jQuery('html').css('font-size');
        jQuery(".resetFont").click(function(){
            jQuery('html').css('font-size', originalFontSize);
            //console.log(originalFontSize);
        });
        // Increase Font Size
        jQuery(".increaseFont").click(function(){
            var currentFontSize = jQuery('html').css('font-size');
            var currentFontSizeNum = parseFloat(currentFontSize, 10);
            var newFontSize = currentFontSizeNum * 1.1;
            jQuery('html').css('font-size', 16.5);
            //console.log(newFontSize);
            return false;
        });
        // Decrease Font Size
        jQuery(".increaseMoreFont").click(function(){
            var currentFontSize = jQuery('html').css('font-size');
            var currentFontSizeNum = parseFloat(currentFontSize, 10);
            var newFontSize = currentFontSizeNum * 0.8;
            jQuery('html').css('font-size', 17);
            return false;
        });
        
//scrolling side bar
        var name = "#rightSide";
        var sidebar_top_limit = 0;
        
        //put condition here
        var sidebar_top_margin = -185;
        
        var sidebar_slide_duration = 1000;
        jQuery(window).scroll(function(){
            offset = jQuery(document).scrollTop() + sidebar_top_margin;
            
            if (offset < sidebar_top_limit) 
                offset = sidebar_top_limit;
            
            jQuery(name).animate({
                top: offset
            }, {
                duration: sidebar_slide_duration,
                queue: false
            });
        });
        
//script to position footer below mainContent and .hdr_box_m is the one which has all the content of LHS inside it
        
       /* jQuery('.hdr_box_m').ready(function(){
								
								homeNewHeight = jQuery('.hdr_box_m').height();
								//alert("homeNewHeight = " + homeNewHeight);
								jQuery('#footer').css("top", homeNewHeight + "px");
								jQuery('#footer').fadeIn('fast');
								
								inNewHeight = jQuery('#leftContentArea').height();
								alert(inNewHeight);
								
								if (jQuery.browser.msie) { //ie7
								jQuery('#footer').css("top", inNewHeight + 115 +  "px");
								} else { //safari and ff
									jQuery('#footer').css("top", inNewHeight + 40 +  "px");
								}
								if (jQuery.browser.msie && parseInt(jQuery.browser.version) >= 8) { //ie8
            						jQuery('#footer').css("top", inNewHeight + 40 +  "px");
        						} 
								
								});*/
		
        /*if (window.console) {
            console.log("homeNewHeight = " + homeNewHeight);
        }*/
		
        
        /*if (jQuery.browser.msie) { //if IE
            jQuery('#footer').css("top", homeNewHeight + 125 + "px");
        }
        else {//if ff or safari
            jQuery('#footer').css("top", homeNewHeight + 65 + "px");
        }*/
        
        //condition for IE8 - inner pages
        /*if (jQuery.browser.msie && parseInt(jQuery.browser.version) >= 8) {
            jQuery('#footer').css("margin-top", homeNewHeight - 865 + "px");
        } else {//if ff or safari
            jQuery('#footer').css("margin-top", homeNewHeight + 565 + "px");
        } 
		
		if (jQuery.browser.msie) { //if IE7
            jQuery('#footer').css("top", homeNewHeight + 125 + "px");
        }*/
        
        /*if (jQuery.browser.msie) { //if IE
            jQuery('#simple-footer').css("top", homeNewHeight + 85 + "px");
        }
        else {//if ff or safari
            jQuery('#simple-footer').css("top", homeNewHeight + 70 + "px");
        }
        jQuery('#footer').fadeIn('fast');
        */
//this is to manage height of the content under .hdr_box_m for inner pages
       /* inNewHeight = jQuery('#leftContentArea').height();
		alert(inNewHeight);
		jQuery('#footer').fadeIn('fast');
        /*jQuery('.hdr_box_m').css("min-height", inNewHeight + 73 + "px");
        if (window.console) {
            console.log("inNewHeight " + inNewHeight);
        }	*/
        //jQuery('#footer').css("top",inNewHeight-500+"px");		*/
		//jQuery('#footer').fadeIn('fast');
    
	
	
    
/*tool tips related*/
    jQuery('#set1 *').tooltip();
    
    
//script for shadows to the button div
    /*jQuery(".button").shadow({
     width:5,
     startOpacity:60,
     endOpacity:10,
     cornerHeight:8,
     color:"#000000"
     });*/
    /*print related*/
    
/*script for printing a div*/
	jQuery("#simplePrint").click(function(){
        jQuery('#toPrint').printElement();
    });
        	

/*marquee*/
	<!--//
	var use_debug = false;

	function debug(){
		if( use_debug && window.console && window.console.log ) console.log(arguments);
	}

	// on DOM ready
	jQuery(document).ready(function (){
		jQuery(".marquee").marquee({
			loop: -1
			// this callback runs when the marquee is initialized
			, init: function (jQuerymarquee, options){
				debug("init", arguments);

				// shows how we can change the options at runtime
				if( jQuerymarquee.is("#marquee2") ) options.yScroll = "bottom";
			}
			// this callback runs before a marquee is shown
			, scrollSpeed: 24
			
			, beforeshow: function (jQuerymarquee, jQueryli){
				debug("beforeshow", arguments);

				// check to see if we have an author in the message (used in #marquee6)
				var jQueryauthor = jQueryli.find(".author");
				// move author from the item marquee-author layer and then fade it in
				if( jQueryauthor.length ){
					jQuery("#marquee-author").html("<span style='display:none;'>" + jQueryauthor.html() + "</span>").find("> span").fadeIn(850);
				}
			}
			// this callback runs when a has fully scrolled into view (from either top or bottom)
			, show: function (){
				debug("show", arguments);
			}
			// this callback runs when a after message has being shown
			, aftershow: function (jQuerymarquee, jQueryli){
				debug("aftershow", arguments);

				// find the author
				var jQueryauthor = jQueryli.find(".author");
				// hide the author
				if( jQueryauthor.length ) jQuery("#marquee-author").find("> span").fadeOut(250);
			}
		});
	});
	
	var iNewMessageCount = 0;
	
	function addMessage(selector){
		// increase counter
		iNewMessageCount++;

		// append a new message to the marquee scrolling list
		var jQueryul = jQuery(selector).append("<li>New message #" + iNewMessageCount + "</li>");
		// update the marquee
		jQueryul.marquee("update");
	}
	
	function pause(selector){
		jQuery(selector).marquee('pause');
	}
	
	function resume(selector){
		jQuery(selector).marquee('resume');
	}
	//-->



});

