// jQuery Change div slide 1.0 - NIck Pelton - 4/19/08  - using Jquery 1.2.3 
// 

var $j = jQuery.noConflict();

$j(function() {


 
// New JQuery functions
	
// VERTICALLY ALIGN FUNCTION
(function ($) {
$j.fn.vAlign = function() {
	return this.each(function(i){
	var ah = $j(this).height();
	var ph = $j(this).parent().height();
	var mh = (ph - ah) / 2;
	$j(this).css('margin-top', mh);
	});
};
})(jQuery);

//$('#example p').vAlign();
 
 
 
/*
 
 	 Blogroll
	
*/
	
//$('#footer .blogList ul li .postDate').css("font-size","30px")
	

// Since the CMS can't format the Blogroll, some fancy JS will. Grabe current date value, convert it to new format, and replace the old format with the new.
$j('#footer .blogList ul li .postDate').each(
												
	function( intIndex ){
      
     	// Bind the onclick event to simply alert the
    	// iteration index value.
    	var dateString = $j( this ).html();
		
		
		var myDate = new Date(dateString);
		 
		// get Date part from the date string
		var date =  myDate.getDate();
		
		
		// get Month part from the date string
		var month = 1+myDate.getMonth();
		
		
		// get Full Year from the date string
		var year = myDate.getFullYear(); 
		
		
		$j(this).html('<div class="newdate">'+month+'.'+date+'</div>')
		 
	}
      
);

//Add a "More" after each blog title with the exisitng link.
$j('#footer .blogList ul li a').each(
											 
	function(index){
		
		//Append the txt more at the end of the link
		$j(this).append(' <span>MORE</span>');
	
		
		}					  
						  
);


// Verticall align the blogroll dates
$j('#footer .blogList ul li .postTitle').vAlign();
$j('#footer .blogList ul li .newdate').vAlign();

	
	
// FancyBox
$j('.rethinkvideo').fancybox({
		
		
		'hideOnContentClick': true,
		'scrolling':'no',
});


/* rotating background */
var randomnumber=Math.floor(Math.random()*3)+1;

			
		switch (randomnumber) {
            case 1:
               $j('#body').css('background','#180A00 url(/Websites/thinkmarketingiq/templates/MarketingIQ/images/background_tile_exclaim.jpg) top center fixed repeat-y');
                break;
				
            case 2:
				$j('#body').css('background','#180A00 url(/Websites/thinkmarketingiq/templates/MarketingIQ/images/background_tile_blimp.jpg) top center fixed repeat-y');
                break;
				
            case 3:
                $j('#body').css('background','#180A00 url(/Websites/thinkmarketingiq/templates/MarketingIQ/images/background_tile_bubbles.jpg) top center fixed repeat-y');
                break;
							
        }

});

function rethinkVideo(){$j('.rethinkvideo').trigger('click');}


function change_parent_url(url)
        {
	    document.location=url;
        }	




