$(document).ready(function(){
	
	$('#customform-mailing-list #Field1').val('JOIN E-MAIL LIST');
	$('#customform-mailing-list #Field1').focus(function() {
		if($('#customform-mailing-list #Field1').val()=='JOIN E-MAIL LIST'){
			$('#customform-mailing-list #Field1').val('');
		};
	});
	$('#customform-mailing-list #Field1').blur(function() {
		if($('#customform-mailing-list #Field1').val()== ''){
			$('#customform-mailing-list #Field1').val('JOIN E-MAIL LIST');
		};
	});
	
	/*$('.column.first .pagecontent img').each(function(index){
		var caption = $(this).attr('alt');
		var detail = $(this).attr('title');
		var side = $(this).attr('class');
		var width = $(this).attr('width') + 2;
		$(this).wrap('<div class="image-wrap ' + side + '" style="width:' + width + 'px" />');
		if($(this).attr('title') != ""){
			$(this).after('<span class="detail">' + detail + '</span>');
		}
		$(this).after('<span class="caption">' + caption + '</span>');
		$(this).removeClass();
	});*/
	
	$('#searchform #q').val('ENTER SEARCH KEYWORDS');
	$('#searchform #q').focus(function() {
		if($('#searchform #q').val()=='ENTER SEARCH KEYWORDS'){
			$('#searchform #q').val('');
		};
	});
	$('#searchform #q').blur(function() {
		if($('#searchform #q').val()== ''){
			$('#searchform #q').val('ENTER SEARCH KEYWORDS');
		};
	});
	
	$('#pedalogin #email').val('EMAIL ADDRESS');
	$('#pedalogin #email').focus(function() {
		if($('#pedalogin #email').val()=='EMAIL ADDRESS'){
			$('#pedalogin #email').val('');
		};
	});
	$('#pedalogin #email').blur(function() {
		if($('#pedalogin #email').val()== ''){
			$('#pedalogin #email').val('EMAIL ADDRESS');
		};
	});
	$('#pedalogin #username').blur(function() {
		if($('#pedalogin #username').val()== ''){
			$('#pedalogin #username').val('USERNAME');
		};
	});
	
	$('#pedalogin #password').val('PASSWORD');
	$('#pedalogin #password').focus(function() {
		if($('#pedalogin #password').val()=='PASSWORD'){
			$('#pedalogin #password').val('');
		};
	});
	$('#pedalogin #password').blur(function() {
		if($('#pedalogin #password').val()== ''){
			$('#pedalogin #password').val('PASSWORD');
		};
	});
	
	/*
	if($('#searchform .inlabel').val()!=""){
			$('#searchform .inlabel').prev().hide();
		};
	$('#searchform .inlabel').focus(function() {
		if($(this).val()==''){
			$(this).prev().hide();
		};
		if($(this).val()!=''){
			$(this).prev().hide();
		};
	});
	$('#searchform .inlabel').blur(function() {
		if($(this).val()== ''){
			$(this).prev().show();
		};
	});
	*/
	
	/*
	$('#hero').tabs({fx:{opacity:'toggle', duration:'fast'}}).tabs("rotate", 10000, true);
	$("#hero").hover(function() {  
		$("#hero").tabs("rotate",0,true);  
	}, function() {  
		$("#hero").tabs("rotate",10000,true);  
	});
	*/
	$("#hero-tabs").tabs("#hero2 > div.slide", {
				
		// enable "cross-fading" effect
		effect: 'fade',
		fadeOutSpeed: "slow",
	
		// start from the beginning after the last tab
		rotate: true
	
	// use the slideshow plugin. It accepts its own configuration
	}).slideshow({
		clickable: false,
		autoplay: true,
		interval: 10000
	});
	/*$('#section-index .two-b .column').each(function(index){
		var columnheight = $(this).height();
		$(this).height(columnheight);
	});*/
	
	/*$('#section-index .two-b').masonry({
		columnWidth: 198,
		itemSelector: '.column.main'
	});*/
	
	$('.app img').click(function(){
		$('.app .gotcha').show();
	});
	$(document).click(function(){
	    $('.app .gotcha').hide();
	});
	$('.app img').click(function(e){
	    e.stopPropagation();
	});
	
	$('.headline-items').cycle({
		fx: 'fade',
		pause: 1,
		speed: 1500,
		speedIn: 1000,
		speedOut: 1000,
		timeout: 10000,
		sync: 0
	});
	
	/*if($('.pagecontent').length) {
		$('.pagecontent a').attr('target', '_blank');
	}
	*/
	//$(".pedagogy-post-link").colorbox({width:"490px", height:"525px", iframe:true});
	
	$('#primary-menu li').hover(
		function(){
			$(this).children('.primary-sub-menu').css({'display':'block'});
			$(this).children('#primary-menu a.off').addClass('active');
		},
		function(){
			$(this).children('.primary-sub-menu').css({'display':'none'});
			$(this).children('#primary-menu a.off').removeClass('active');
		}
	);
	$('.ribbon ul li').hover(
		function(){
			$(this).children('.secondary-sub-menu').css({'display':'block'});
		},
		function(){
			$(this).children('.secondary-sub-menu').css({'display':'none'});
		}
	);

});
    
Cufon.replace('.ltr h1, .ltr h2.item-title, h2.heading, #primary-menu li.non a, .textSlide h2, .module h3 .ltr, .ribbon a, .headlines h3, .socialwrap h3');
			
function validate_email(field,alerttxt) {
	with (field) { 
		apos=value.indexOf("@");
		dotpos=value.lastIndexOf(".");
		if (apos<1||dotpos-apos<2) {
			alert(alerttxt);
			return false;
		}
		else { return true; }
	}
}
function validate_form(thisform,fieldtovalidate)
{
	with (thisform)
	{
	if (validate_email(fieldtovalidate,"Not a valid e-mail address!")==false)
	  { return false;}
	}
}

function popUp2(message) {

var x = 20;
var y = 20;

	var windowparam = "width=" + 650 + ",height=" + 700 + ",scrollbars=yes,menubar=no,left="+x+",top="+y+",screenX="+x+",screenY="+y;
	popwin = window.open(message, "popwin", windowparam)
	popwin.opener = self;
	popwin.focus()
}
		
function validate_email(field,alerttxt) {
	with (field) { 
		apos=value.indexOf("@");
		dotpos=value.lastIndexOf(".");
		if (apos<1||dotpos-apos<2) {
			alert(alerttxt);
			return false;
		}
		else { return true; }
	}
}
