// JavaScript Document


function equalHeightTemaerBoxes(){
    jQuery(".emmerSelectListBoxes .cornersR:nth-child(4n+1)").each(function(i) {
        jQuery(this).addClass("newRow");

    });
    alert("asd");
}
jQuery(document).ready(function() {

    jQuery.noConflict();


    jQuery("#arhiveBoxTeaser .cornersR:nth-child(3n+1)").each(function(i) {
        jQuery(this).addClass("newRow");

    });

    /*
    -----------------------------------------------
    / Equalize height 
    -----------------------------------------------
    */


    var homePageTeaser1Height = 0;

    jQuery(".cornersHalf.forside .content").each(function(i) {
        if (homePageTeaser1Height < jQuery(this).height()) {
            homePageTeaser1Height = jQuery(this).height();
        }
    });


    jQuery(".cornersHalf.forside .content").each(function(i) {
        jQuery(this).height(homePageTeaser1Height + "px");

    });


    var homePageCornersRHeight = 0;

    jQuery(".cornersR.forside .rightContent").each(function(i) {
        if (homePageCornersRHeight < jQuery(this).height()) {
            homePageCornersRHeight = jQuery(this).height();
        }
    });

    jQuery(".cornersR.forside .rightContent").each(function(i) {
        jQuery(this).height(homePageCornersRHeight + "px");

    });

//equalizeHeight2Cols(".content ",".inside.temaer .cornersHalf", ".teaserWide", ".teaserWide h3", ".teaserWideContent");


equalizeHeight2Cols(".cornersHalf .content ",".inside.temaer ");
function equalizeHeight2Cols(itemName, container){

	var container = container;
	var itemName = itemName;

	jQuery(itemName).each(function (i) {								
		if ( (i % 2) == 0){
			elemHeight = jQuery(itemName).eq(i).height();
			if (elemHeight < jQuery(itemName).eq(i+1).height()){
				elemHeight = jQuery(itemName).eq(i+1).height();
			}	
			jQuery(itemName).eq(i).height(elemHeight + "px");
			jQuery(itemName).eq(i+1).height(elemHeight + "px");
			
	}

	});

}



    // if there are less than three teasers on a row, we need to clear the content or it won't take into consideration the .graphicTeaser{margin-bottom: 10px;}
    /*
    if(jQuery.browser.msie){
    jQuery(".teasers").append('<br style="clear: both; />"');
    }
    */
});