/**
 * Sugar Arrays (c) Creative Commons 2006
 * 
 * http://creativecommons.org/licenses/by-sa/2.5/
 * Author: Dustin Diaz | http://www.dustindiaz.com
 * Reference: http://www.dustindiaz.com/basement/sugar-arrays.html
 * 
 * Array.prototype.forEach, every, some, map, filter, indexOf, lastIndexOf
 **/

Function.prototype.method=function(name,fn){this.prototype[name]=fn;return this;};if(!Array.prototype.forEach){Array.method('forEach',function(fn,thisObj){var scope=thisObj||window;for(var i=0,j=this.length;i<j;++i){fn.call(scope,this[i],i,this);}}).method('every',function(fn,thisObj){var scope=thisObj||window;for(var i=0,j=this.length;i<j;++i){if(!fn.call(scope,this[i],i,this)){return false;}}return true;}).method('some',function(fn,thisObj){var scope=thisObj||window;for(var i=0,j=this.length;i<j;++i){if(fn.call(scope,this[i],i,this)){return true;}}return false;}).method('map',function(fn,thisObj){var scope=thisObj||window;var a=[];for(var i=0,j=this.length;i<j;++i){a.push(fn.call(scope,this[i],i,this));}return a;}).method('filter',function(fn,thisObj){var scope=thisObj||window;var a=[];for(var i=0,j=this.length;i<j;++i){if(!fn.call(scope,this[i],i,this)){continue;}a.push(this[i]);}return a;}).method('indexOf',function(el,start){var start=start||0;for(var i=start,j=this.length;i<j;++i){if(this[i]===el){return i;}}return-1;}).method('lastIndexOf',function(el,start){var start=start||this.length;if(start>=this.length){start=this.length;}if(start<0){start=this.length+start;}for(var i=start;i>=0;--i){if(this[i]===el){return i;}}return-1;});};

// Viewport size

function get_viewport_height(){var viewportheight;if(typeof window.innerWidth!='undefined')viewportheight=window.innerHeight;else if(typeof document.documentElement!='undefined'&&typeof document.documentElement.clientWidth!='undefined'&&document.documentElement.clientWidth!=0)viewportheight=document.documentElement.clientHeight;else viewportheight=document.getElementsByTagName('body')[0].clientHeight;return viewportheight;};

function get_viewport_width(){var viewportwidth;if(typeof window.innerWidth!='undefined')viewportwidth=window.innerWidth;else if(typeof document.documentElement!='undefined'&&typeof document.documentElement.clientWidth!='undefined'&&document.documentElement.clientWidth!=0)viewportwidth=document.documentElement.clientWidth;else viewportwidth=document.getElementsByTagName('body')[0].clientWidth;return viewportwidth;};

/* window.onload */

//window.onload = function(){
//jQuery(document).ready(function() {
jQuery(document).ready(function($) {
    // adjust the viewport height
    var viewport_height = get_viewport_height();
    $('#page').css('min-height',viewport_height-14);
    $(window).resize(function(){
        var viewport_height = get_viewport_height();
        $('#page').css('min-height',viewport_height-14);
    });

    $('.post-title a').each(function(){
        $(this).hover(
            function(){
                $('.images h1').css('color', '#000')
                $('#' + $(this).attr('class')).css('display', 'block');
            },
            function(){
                $('.images h1').css('color', '#666')
                $('#' + $(this).attr('class')).css('display', 'none');
            }
        );
    });
    //Taggage lien ext
    $('div.entry-content a').click(function(){
		if (this.href.indexOf('http://www.chanel-news.com/')!=0 && this.href.indexOf('http://chanel-news.chanel.com/')!=0 && this.href.indexOf('/')!=0) {
			wt_register_click ( 'Links', 'Link_'+this.href, '' );
		}
	});
});
//};


