Cufon.replace('#Logo',{hover: true});
Cufon.replace('#BodyText h4',{hover: true});
Cufon.replace('label',{hover: true});
Cufon.replace('.wp-pagenavi',{hover: true});
Cufon.replace('#ReadMore h4',{hover: true});

if (document.images) {
    img1 = new Image();
    img1.src = "/wp-content/themes/iamkoreanamerican/img/dropdown_arrow_selected.gif";
}


$(function () {

	
	
	$("#1210129727").validate();
	
	$("#2622345447").validate();
	$("#2622820437").validate();
	$("#2621055387").validate();
	$("#2623203439").validate();
	$("#10795202234").validate();

	$('#NewQuestion img').show();
	$('#PhotoGuidelines img').show();
	$('#SamplePhoto img').show();
	
	$('.playmusic').click(function(){
		$(this).parent().parent().parent().children('.musicplayer').slideToggle();
	});
	
	$('#PopularLocations').click(function(){
		$('.popularlocationsdropdown').toggle();
	});
	
	$("#PopularLocations").mouseleave(function(){
	    $('.popularlocationsdropdown').fadeOut();
	});
	
	$("#PopularLocations").mouseleave(function(){
	    $('.popularlocationsdropdown').fadeOut();
	});
	
	
});

var i = 0;//initialize
var int=0;//Internet Explorer Fix
$(window).bind("load", function() {//The load event will only fire if the entire page or document is fully loaded
	//var int = setInterval("doThis(i)",200);//500 is the fade in speed in milliseconds
});

function doThis1() {
	var images = $('img').length;//count the number of images on the page
	if (i >= images) {// Loop the images
		clearInterval(int);//When it reaches the last image the loop ends
	}
	$('img:hidden').eq(0).fadeIn(200);//fades in the hidden images one by one
	i++;//add 1 to the count
}

$(function() {
    $('#SubmitChanger').cycle({ 
		fx: 'fade',
        speed: 1000,
		timeout: 0,
		next: '#NewQuestionButton',
		pager:  '#nav',
		random: 1,
		pagerAnchorBuilder: function(idx, slide) { 
		        return '<a href="#"></a>'; 
		    }
    });

	$('#ShopSlideshow').cycle({ 
		fx: 'fade',
        speed: 2000,
		timeout: 3000,
		pagerAnchorBuilder: function(idx, slide) { 
		        return '<a href="#"></a>'; 
		    }
    });
});

$().ready(function() {
  $('#dialog').jqm();
$('#dialog2').jqm({trigger: '#AboutTheModels'}); 
  
});


$(document).ready(function(){
	


if (window.location.hash){
	if (window.location.hash == "#profile"){	
		$("#SubmitNav ul").idTabs("tab1"); 
	}
	if (window.location.hash == "#entrepreneur"){
		$("#SubmitNav ul").idTabs("tab2"); 
	}
	if (window.location.hash == "#musician"){
		$("#SubmitNav ul").idTabs("tab3"); 
	}
	if (window.location.hash == "#projectcause"){
		$("#SubmitNav ul").idTabs("tab4"); 
	}
}
else {
	$("#SubmitNav ul").idTabs();
}

/**
 * Character Counter for inputs and text areas
 */
$('#q13').each(function(){
	// get current number of characters
	var length = $(this).val().length;
	// get current number of words
	//var length = $(this).val().split(/\b[\s,\.-:;]*/).length;
	// update characters
	$(this).parent().find('.counter').html( length + ' characters');
	// bind on key up event
	$(this).keyup(function(){
		// get new length of characters
		var new_length = $(this).val().length;
		// get new length of words
		//var new_length = $(this).val().split(/\b[\s,\.-:;]*/).length;
		// update
		$(this).parent().find('.counter').html( new_length + ' characters ');
	});
});

});


$.fn.delayPopup = function(options) {
	var options = $.extend({ delaytime: 3800 }, options);
 	timer();
	function timer() {
		if($.cookie('iaka_newsletter') != 1) {
			setTimeout(showLightbox, options.delaytime);

		}
	}
	function showLightbox() {		
		$('#Enewsletter').jqm({trigger: '#EnewsletterPopup', overlay: 80}); 
		$('#Enewsletter').jqmShow();
		$.cookie('iaka_newsletter', '1', { expires: 60, path: '/' });	
	}
};

$(function() {
	
$('#EnewsletterTrigger').delayPopup({delaytime: 3800});

});


