$(document).ready(function(){
	if ($.browser.msie && $.browser.version == 6) {
		$('.flash').children('object').attr('height', 280);
		$('.flash').children('object').attr('width', 520);
	}
	$('#no-flash').children('DIV').html('No movie has been uploaded for this project...');

	if ($('#theme').hasClass('about')){
		$('UL.main-menu').children('LI:eq(1)').addClass('current_page_item');
	}
	if ($('#theme').hasClass('services')){
		$('UL.main-menu').children('LI:eq(2)').addClass('current_page_item');
	}
	if ($('#theme').hasClass('contact')){
		$('UL.main-menu').children('LI:eq(4)').addClass('current_page_item');
	}
	if ($('#theme').hasClass('our-work-web') || $('#theme').hasClass('our-work-print') || $('#theme').hasClass('our-work-motion')){
		$('UL.main-menu').children('LI:eq(3)').addClass('current_page_item');
	}
	if ($('body').hasClass('home')){
		$('UL.main-menu').children('LI').removeClass('current_page_item');
		$('UL.main-menu').children('LI:first').addClass('current_page_item');
	}
	
	
	
	$('.wpcf7-form').addClass('clearfix');
	$('.wpcf7').prepend('<h3>Contact Form:</h3>');
	$("#f_name").attr("title", "First Name");
	$("#l_name").attr("title", "Last Name");
	$("#email").attr("title", "E-mail");
	$("#phone").attr("title", "Phone");
	$(".wpcf7-form INPUT[type=submit]").val("");
	$(".wpcf7-form INPUT[type=submit]").val("");
	$('div.wpcf7-response-output').replaceWith('');
	$('.sidebar .wpcf7 P:last').prepend('<div class="wpcf7-response-output wpcf7-display-none"></div>');
	$('.main .wpcf7 P:last').prepend('<div class="wpcf7-response-output wpcf7-display-none"></div>');
	
	$('FORM.wpcf7-form').submit(function(){
		if ( $('INPUT#f_name').val() == 'First Name' ) {
			$('INPUT#f_name').val('');
		}
		if ( $('INPUT#l_name').val() == 'Last Name' ) {
			$('INPUT#l_name').val('');
		}
		if ( $('INPUT#phone').val() == 'Phone' ) {
			$('INPUT#phone').val('');
		}
		if ( $('INPUT#email').val() == 'E-mail' ) {
			$('INPUT#email').val('');
		}
	});
	
	$('INPUT#f_name').hover(function(){
		if ($(this).val() == '') {
			$(this).val('First Name');
		}
	});
	$('INPUT#l_name').hover(function(){
		if ($(this).val() == '') {
			$(this).val('Last Name');
		}
	});
	$('INPUT#phone').hover(function(){
		if ($(this).val() == '') {
			$(this).val('Phone');
		}
	});
	$('INPUT#email').hover(function(){
		if ($(this).val() == '') {
			$(this).val('E-mail');
		}
	});
	
	$('INPUT.auto-hint').each(function(i, el){
        if($(this).val() == ''){
            $(this).val($(this).attr('title'));
        }
        $(el).focus(function(){
            if ($(this).val() == $(this).attr('title')) {
                $(this).val('');
            }       
        });
        $(el).blur(function(){
            if ($(this).val() == '') {
                $(this).val($(this).attr('title'));
            }
        });
    });
    
    if ( $('#theme').hasClass('home')) {
    
	    /* Initializing themes names */
	    var themes = new Array ('home', 'about', 'contact', 'services', 'our-work-print', 'our-work-motion', 'our-work-web');
	    /* count of themes */
		var bgImageTotal = themes.length;
		/* getting random number of theme */
		var randomNumber = Math.round(Math.random()*(bgImageTotal-1));
		/* getting current theme image title and path */
		var imgTitle = themes[randomNumber];
		var imgPath = ('public/images/themes/'+imgTitle+'.jpg');
		/* set logotype for current theme */
		var logoPath = ('public/images/logotypes/'+imgTitle+'.gif');
	/*
		$('#'+imgTitle).css('display', 'block');
		$('A.logo').html('<img src=' +logoPath+ ' alt="San Diego Web Design" />');
		$('#theme').addClass(imgTitle);
		Cufon.replace('.slogan H2')('.content H1')('.content H2', {hover: true})('.content H3')('.map H4');
		$('.header').css('background-image', ('url("'+imgPath+'")'));
	} else {
		var title = $('#theme').attr('class');
		var logo = ('public/images/logotypes/'+title+'.gif');
		
		$('#'+title).css('display', 'block');
		$('A.logo').html('<img src=' +logo+ ' alt="San Diego Web Design" />');
		Cufon.replace('.slogan H2')('.content H1')('.content H2', {hover: true})('.content H3')('.map H4');
	}	
	*/
	Cufon.replace('.slogan H2')('.content H1')('.content H2', {hover: true})('.content H3')('.map H4');
	}
	Cufon.replace('.slogan H2')('.content H1')('.content H2', {hover: true})('.content H3')('.map H4');
	$('UL.main-menu LI').hover(function(){
		$(this).children('UL').slideDown(150);
	},function(){
		$(this).children('UL').slideUp(150);
	});
});	
