jQuery(document).ready(function() {



	$("#contact").validate({
		rules: {
			name: "required",
			email: {
				required: true,
				email: true				
			}
		},
		messages: {
			firstName:"Type your first name",
			email: "Enter your email address"
		}
	
	});
	
	jQuery.validator.addMethod("phoneUS", function(phone_number, element) {
    phone_number = phone_number.replace(/\s+/g, ""); 
	return this.optional(element) || phone_number.length > 9 &&
		phone_number.match(/^(1-?)?(\([2-9]\d{2}\)|[2-9]\d{2})-?[2-9]\d{2}-?\d{4}$/);
}, "Please enter a valid phone number");

	
	$("#employment").validate({
		rules: {
			formname: "required",
			lastname: "required",
			phone: {
				required: true,
				phoneUS: true
			},
			best: "required",
			why: "required",
			filename: "required",
			email: {
				required: true,
				email: true				
			}
		},
		messages: {
			filename:"You must attach your resume"
		}
	
	});


//   	jQuery.noConflict();

   	// Animate body links
   	jQuery("#colLeft a").hover(function() {
	//	jQuery(this).animate( {color:'#FFF',backgroundColor:'#e00000'}, 200);
	});
   	jQuery("#colLeft a").mouseleave(function() {
	//	jQuery(this).animate( {color:'#000027',backgroundColor:'#cbd2dc'}, 200);
	});

   	jQuery('ul#innerfadeRotate').innerfade({
				speed: 750,
				timeout: 5000,
				type: 'sequence',
				containerheight: '222px'
			});
			
	jQuery('.expandBox').each(function(){
		var box = jQuery(this);
		var title = jQuery(this).find('.expandTitle')[0];
		var content = jQuery(this).find('.expandContent')[0];
		
		jQuery(title).click(function(){
			jQuery(content).slideToggle("normal");
			return false;
		});
		
	});
	
	reZebra();

   	if(typeof sIFR == "function"){
		sIFR.replaceElement(named({sSelector:"body h1", sWmode:"transparent", sFlashSrc:"/flash/h1.swf", sColor:"#000027", sLinkColor:"#000027", sBgColor:"#FFFFFF", sHoverColor:"#e00000", nPaddingTop:0, nPaddingBottom:0, sFlashVars:""}));
	}
   	
   	
});

var popup;
function openweekly(url)
{
	popup=window.open(url,'name','height=560,width=690,left=0,top=0,resizable=no,scrollbars=no,toolbar=no,status=no');
	if (window.focus) {popup.focus()}
}

function showDisplay(tip,valuta,intip,targ) {
	var url = "/content/prices/index.php";
	var param = "val="+valuta+"&type="+tip+"&intype="+intip;
	
	var insertInto;
	if(intip == 'days')
		insertInto = "#DaysAjax";
	else if(intip == 'cur')
		insertInto = "#CurAjax";
	else if(intip == 'extra')
		insertInto = "#ExtraAjax";
	
	if(!insertInto) return false;
	
	$(targ).parent().parent().addClass("ajaxOn");
	$(insertInto).css("opacity","0.5");
	$(insertInto).load(url,param,function(){
		$(insertInto).css("opacity","1");
		$(targ).parent().parent().removeClass("ajaxOn");
		reZebra();
	});
}

function reZebra() {
	jQuery('.zebra').each(function(){
		jQuery(this).find('tr').each(function(x){
			if(x % 2 == 0) jQuery(this).addClass('oddRow');
		});
	});
}