var boxcounter=1;


$(document).ready(function() {
	$("div.subpage p:even").addClass("evenps");  // adds the class evenps to every other even p element.
	$("div.subpage p:odd").addClass("oddps");  // adds the class oddps to every other odd p element.
	$("div.subpage p img").each(function(intIndex) {
		var whichway=$(this).parent().attr("class");
		$(this).addClass(whichway);
		$(this).insertBefore($(this).parent().prev());
		$('<div class="clear"></div>').insertBefore($(this));
	});

	$("div.subpage>p:first-child").addClass("firstelement");
	$("div.subpage>h1:first-child").addClass("firstelement");
	$("div.subpage>h2:first-child").addClass("firstelement");
	$("div.subpage blockquote").prependTo("div.subpage");
	$(".firstelement").prependTo("div.subpage");
	

$(".hoverImg").hover(function() {
                $(this).attr("src", $(this).attr("src").split("1.").join("2."));
        }, function() {
                $(this).attr("src", $(this).attr("src").split("2.").join("1."));
        });

        $("#wrapper").append('<div id="preload" style="display: none;"></div>');
        $(".hoverImg").each(function(intIndex) {
                $("#preload").append('<img src="'+$(this).attr("src").split("1.").join("2.")+'" style="display: none;" />');
        });


 $(".promovideo").fancybox({
	  'padding'           : 0,
        'autoScale'             : false,
        'transitionIn'          : 'none',
                'transitionOut'         : 'none'
        });






});

/*function movebox(){
        boxcounter++;
	if(boxcounter > $('#slider-two .panel').length){
		boxcounter=1;
	}
	$('#slider-two').data('movingBoxes').currentPanel(boxcounter);

}

function checkslider(){
setTimeout(function(){
	if($('#slider-two').data('movingBoxes').currentPanel() == $('#slider-two .panel').length)
		$('a.right').addClass('hideme');
	else{
		$('a.right').removeClass('hideme');
	}
	
	//alert($('#slider-two').data('movingBoxes').currentPanel());
	if($('#slider-two').data('movingBoxes').currentPanel() == 1)
		$('a.left').addClass('hideme');
	else{
		$('a.left').removeClass('hideme');
	}
	},"1000")
}*/

