jQuery.noConflict();
jQuery(document).ready(function(){
	// Equalize Heights of Floating Columns
	jQuery(".equal").equalize();
	jQuery(window).resize(function(){ 
		jQuery(".equal").equalize();
	});
	
	jQuery(".slideshow").each(function(){
		jQuery(this).nivoSlider({effect:'sliceDown',animSpeed:50,pauseTime:4500, directionNav:false });
		
	});
	
	jQuery("table tr:nth-child(even)").addClass("tr-odd");
	jQuery("table tr:nth-child(odd)").addClass("tr-even");
	
	window.setTimeout(function(){ jQuery(".equal").equalize(); }, 500);
	window.setTimeout(function(){ jQuery(".equal").equalize(); }, 1000);
	window.setTimeout(function(){ jQuery(".equal").equalize(); }, 1500);
	
	jQuery(".csc-textpic-caption div").each(function(){
		if(jQuery(this).text() == "" || jQuery(this).text() == "\n"){
			jQuery(this).parent().remove();
		}
	});
	
	jQuery('.tabs').tabs({selected:0});
	
	window.setTimeout("swfready()", 500);
	window.setTimeout("swfready()", 1000);
	window.setTimeout("swfready()", 1500);
	window.setTimeout("swfready()", 2000);
	
	jQuery("#uid36_0").attr("value",jQuery("input[name=value_uid36_0]").attr("value"));
	jQuery("#uid37_0").attr("value",jQuery("input[name=value_uid37_0]").attr("value"));
	jQuery("#check_uid36_0, #check_uid37_0").attr("checked","checked");
	
	jQuery("#powermaildiv_uid33 td.td-1,#powermaildiv_uid33 td.td-2,#powermaildiv_uid33 td.td-3").each(function(i){
	    var e = jQuery(this);
	    var v = e.prevAll(".td-0").text();
	    v = v + " - " + jQuery("#powermaildiv_uid33 th." + e.attr("class")).text();
	    v = v.replace(/\*/g,"");
	    e.append("<br />");
	    var i = jQuery("<input type='radio' name='ticket' value='"+v+"'/>");
	    e.append(i);
	    i.change(function(){
			jQuery("#uid32").val(jQuery(this).attr("value"));
	    });
	});
	jQuery("#powermaildiv_uid33 tr:gt(4) input").remove();
	jQuery("#powermaildiv_uid33 tr:gt(5) td:gt(0)").first().each(function(i){
	    var e = jQuery(this);
	    var i = jQuery("<input type='checkbox' name='gala' value='yes'/>");
	                        //e.append("<br />");
	    e.append(i);
		i.change(function(){
			if(i.attr("checked")){
				jQuery("#uid19").val("yes");
			}else{
				jQuery("#uid19").val("no");
			}
		})
	});
});

//function swfobjectReady(){ window.setTimeout("swfready()", 500); }
function swfready(){ 
	jQuery(".equal").children("div:not(.clear)").css("min-height","0px");
	jQuery(".equal").equalize(); 
	jQuery(".csc-frame-frame1 .csc-textpic-single-image").each(function(){
	    var el = jQuery(this);
	    var img = el.find("img");
		if(el.height() > img.height()){
//			console.log(this);
//			console.log(el.height(), img.height());
//			el.height(img.height() - 20);
//			el.width("auto");
		}
	    var margin = (el.height() - img.height()) / 2;
	    img.css("margin-top", margin + "px");
	    var left = (el.width() - img.width()) / 2;
	    img.css("margin-left", left + "px");
	});
	jQuery(".csc-frame-frame2 .csc-textpic-single-image").each(function(){
	    var el = jQuery(this);
	    var img = el.find("img");
	    var top = (el.height() - img.height()) / 2;
	    img.css("margin-top", top + "px");
	    var left = (el.width() - img.width()) / 2;
	    img.css("margin-left", left + "px");
	});
}
