function mainmenu(){
$("ul#nav ul, #dropnav ul ul").css({display: "none"}); // Opera Fix
$("ul#nav li, #dropnav li").hover(function(){
$(this).addClass('active');
$(this).find('ul:first').css({visibility: "visible",display: "none"}).fadeIn(300);
},function(){
$(this).removeClass('active');
$(this).find('ul:first').css({visibility: "hidden"});
});
}

$(function() {
	mainmenu();
	
	$(".lightboxgallery a").attr({"rel":"prettyPhoto[gallery]"});
	
	$('#dropnav ul ul').append('<div class="arrow"></div>');
	
	
	$('.videotestimonial span').css({"opacity":"0.3"});
	$('.videotestimonial').hover(function() {
		$(this).find('span').animate({"opacity":"1"});
	}, function() {
		$(this).find('span').animate({"opacity":"0.3"});	
	});
	
	$('#newheader a.logo').hover(function() {
		$(this).find('img.hover').fadeIn();
	}, function() {
		$(this).find('img.hover').fadeOut();
	});
	
	$('#newheader #s').focus(function() {
		if($(this).attr("value") == "Search our website") { $(this).attr("value",""); }
	});
	$('#newheader #s').blur(function() {
		if($(this).attr("value") == "") { $(this).attr("value","Search our website"); }
	});
	
	var homeslidetoshow = 0;
	$('#homecols .col ul.slidenumbers li').click(function() {
		homeslidetoshow = $(this).parent('ul').find('li').index($(this));
		$(this).parent('ul').parent('div').find('ul.posts').find('li').hide();
		if(homeslidetoshow == 0) {
			$(this).parent('ul').parent('div').find('ul.posts').find('li.post_a').fadeIn();
		} else if(homeslidetoshow == 1) {
			$(this).parent('ul').parent('div').find('ul.posts').find('li.post_b').fadeIn();
		} else if(homeslidetoshow == 2) {
			$(this).parent('ul').parent('div').find('ul.posts').find('li.post_c').fadeIn();
		}
		$(this).parent('ul').find('li').removeClass('active');
		$(this).addClass('active');
	});

	
	$('#homecols a.showsubscribepanel').click(function() {
		$('#homecols .subscribe').fadeIn(700);
		return false;
	});
	
	$('#homecols .subscribe').click(function() {
		$('#homecols .subscribe').fadeOut(700);
	});
	
	
	$('.box_testimonials ul.testimonials li').hover(function() {
		$('.box_testimonials ul.testimonials h4 a').css({"color":"#cc0000"});
	}, function() {
		$('.box_testimonials ul.testimonials h4 a').css({"color":"#333"});
	});
	
	$('ul#nav ul li a, #dropnav li a').hover(function() {
		$(this).find('img').hide();
		$(this).find('img.hover').show();
	}, function() {
		$(this).find('img').hide();
		$(this).find('img.normal').show();
	});
	
	$('#banner .slide .inside a').hover(function() {
		$(this).find('img.normal').hide();
		$(this).find('img.hover').show();
	}, function() {
		$(this).find('img.hover').hide();
		$(this).find('img.normal').show();
	});
	
	
	$('.navwidgetpage ul li:first').addClass('changetoh4');
	
	
	$('.subfooter1 form').hover(function() {
		$('.subfooter1 p.heading span').text("Newsletter");
	}, function() {
		$('.subfooter1 p.heading span').text("");
	});
	$('.subfooter1 .col_twitter').hover(function() {
		$('.subfooter1 p.heading span').text("Twitter");
	}, function() {
		$('.subfooter1 p.heading span').text("");
	});
	$('.subfooter1 .col_facebook').hover(function() {
		$('.subfooter1 p.heading span').text("Facebook");
	}, function() {
		$('.subfooter1 p.heading span').text("");
	});
	$('.subfooter1 .col_youtube').hover(function() {
		$('.subfooter1 p.heading span').text("YouTube");
	}, function() {
		$('.subfooter1 p.heading span').text("");
	});
	
	
		
	
	
	var numberofslides = $('#banner .slide').size();
	var x = numberofslides - 1;
	var startlocation = numberofslides*278 - 278;
	startlocation = startlocation - startlocation - startlocation;
	$('#banner #slides').css({"top":startlocation});
	var newlocation;
	
	function slideright() {
		x++;
		if(x == numberofslides) { x = 0; }
		newlocation = x*278;
		newlocation = newlocation - newlocation - newlocation;
		$('#banner #slides').animate({"top":newlocation});
	}
	
	function slideleft() {
		x--;
		if(x < 0) { x = numberofslides - 1; }
		newlocation = x*278;
		newlocation = newlocation - newlocation - newlocation;
		$('#banner #slides').animate({"top":newlocation});
	}
	
	$('#banner #arrows .arrowright').click(function() {
		slideleft();
		stopautomatic=1;
		return false;
	});
	
	$('#banner #arrows .arrowleft').click(function() {
		slideright();
		stopautomatic=1;
		return false;
	});
	
	var stopautomatic=0;
	setInterval(function() {
	if(stopautomatic == 0) {
	slideleft();
	}
	}, 5000);
	
	
	
	$('a.showarchive').click(function() {
		$('.archive').slideToggle();
		return false;
	});
	
	
	var togglesubscribe = 0;
	$('a.togglesubscribe').click(function() {
		if(togglesubscribe == 0) {
			togglesubscribe = 1;
			$(this).find('img').hide();
			$(this).find('img.up').show();
			$('.widget_subscribe .subscribe').fadeIn();
		} else {
			togglesubscribe = 0;
			$(this).find('img').show();
			$(this).find('img.up').hide();
			$('.widget_subscribe .subscribe').fadeOut();
		}
		return false;
	});
	$('a.togglesubscribe').hover(function() {
		$(this).find('img.normal').hide();
		$(this).find('img.hover').show();
	}, function() {
		$(this).find('img.normal').show();
		$(this).find('img.hover').hide();
	});
	
	
	var toggleinterested = 0;
	$('a.toggleinterested').click(function() {
		if(toggleinterested == 0) {
			toggleinterested = 1;
			$('.widget_interested .interested').fadeIn();
			$(this).find('img').hide();
			$(this).find('img.down').show();
		$('.widget_interested .interested p.twoinputs input:first').attr("value","Type this");
		} else {
			toggleinterested = 0;
			$('.widget_interested .interested').fadeOut();
			$(this).find('img').show();
			$(this).find('img.down').hide();
		}
		return false;
	});
	
	
	
	
	
	$('.tabbar li').click(function() {
		$('.tabpanes .tab').hide();
		$('.tabbar li').removeClass('a_active');
		$('.tabbar li').removeClass('b_active');
		$('.tabbar li').removeClass('c_active');
	});
	
	$('.tabbar li.a').click(function() {
		$('.tabpanes .tab1').fadeIn();
		$('.tabbar li.a').addClass('a_active');
	});
	
	$('.tabbar li.a').hover(function() {
		$('.tabbar li.a').addClass('a_activehover');
	}, function() {
		$('.tabbar li.a').removeClass('a_activehover');
	});
	
	$('.tabbar li.b').click(function() {
		$('.tabpanes .tab2').fadeIn();
		$('.tabbar li.b').addClass('b_active');
	});
	
	$('.tabbar li.b').hover(function() {
		$('.tabbar li.b').addClass('b_activehover');
	}, function() {
		$('.tabbar li.b').removeClass('b_activehover');
	});
	
	$('.tabbar li.c').click(function() {
		$('.tabpanes .tab3').fadeIn();
		$('.tabbar li.c').addClass('c_active');
	});
	
	$('.tabbar li.c').hover(function() {
		$('.tabbar li.c').addClass('c_activehover');
	}, function() {
		$('.tabbar li.c').removeClass('c_activehover');
	});
	
	
	$('.box_domain .right a, .subfooter1 .line2 a.button, #banner  a.button').mousedown(function() {
		$(this).find('img').hide();
		$(this).find('.hover').show();
	});
	
	$('.box_domain .right a, .subfooter1 .line2 a.button, #banner  a.button').hover(function() {
		$(this).find('img').hide();
		$(this).find('.hover').show();
	}, function() {
		$(this).find('img').show();
		$(this).find('.hover').hide();
	});
	
	
	$('.subfooter1 #s').focus(function() {
		if($(this).attr("value") == "Search our wonderful website") { $(this).attr("value",""); }
	});
	$('.subfooter1 #s').blur(function() {
		if($(this).attr("value") == "") { $(this).attr("value","Search our wonderful website"); }
	});
	
	$('#sidebar #s').focus(function() {
		if($(this).attr("value") == "Search The LaunchPad Blog") { $(this).attr("value",""); }
	});
	$('#sidebar #s').blur(function() {
		if($(this).attr("value") == "") { $(this).attr("value","Search The LaunchPad Blog"); }
	});
	
	$('p.name input').focus(function() {
		if($(this).attr("value") == "Just tell us your name*") { $(this).attr("value",""); }
	});
	$('p.name input').blur(function() {
		if($(this).attr("value") == "") { $(this).attr("value","Just tell us your name*"); }
	});
	
	$('p.email input').focus(function() {
		if($(this).attr("value") == "email address*") { $(this).attr("value",""); }
	});
	$('p.email input').blur(function() {
		if($(this).attr("value") == "") { $(this).attr("value","email address*"); }
	});
	
	$('p.email2 input').focus(function() {
		if($(this).attr("value") == "Email address*") { $(this).attr("value",""); }
	});
	$('p.email2 input').blur(function() {
		if($(this).attr("value") == "") { $(this).attr("value","Email address*"); }
	});
	
	$('p.phone input').focus(function() {
		if($(this).attr("value") == "phone number") { $(this).attr("value",""); }
	});
	$('p.phone input').blur(function() {
		if($(this).attr("value") == "") { $(this).attr("value","phone number"); }
	});
	
	$('p.phone2 input').focus(function() {
		if($(this).attr("value") == "Phone No. (if you like)") { $(this).attr("value",""); }
	});
	$('p.phone2 input').blur(function() {
		if($(this).attr("value") == "") { $(this).attr("value","Phone No. (if you like)"); }
	});
	
	$('p.message input').focus(function() {
		if($(this).attr("value") == "and anything else you like") { $(this).attr("value",""); }
	});
	$('p.message input').blur(function() {
		if($(this).attr("value") == "") { $(this).attr("value","and anything else you like"); }
	});
	
	$('#header .searchform input#s').focus(function() {
		if($(this).attr("value") == "Search our website") { $(this).attr("value",""); }
	});
	$('#header .searchform input#s').blur(function() {
		if($(this).attr("value") == "") { $(this).attr("value","Search our website"); }
	});
	
	
	
	$('p.verification input').focus(function() {
		if($(this).attr("value") == "then type this:") { $(this).attr("value",""); }
	});
	$('p.verification input').blur(function() {
		if($(this).attr("value") == "") { $(this).attr("value","then type this:"); }
	});
	
	$('p.twoinputs input').focus(function() {
		if($(this).attr("value") == "Type this") { $(this).attr("value",""); }
	});
	$('p.twoinputs input').blur(function() {
		if($(this).attr("value") == "") { $(this).attr("value","Type this"); }
	});
	
	$('.footer1 li:last').addClass('last');
	
	
	$('.wpcf7-response-output').click(function() {
		if($(this).html() == "Your message was sent successfully. Thanks. Click here to hide the contact form.") {		
			headercontactboxx = 0; 
			$('#header .contactbox').animate({"top":"-435px"});
		}
		$(this).fadeOut();
	});
	
	
	
	$('a.hoverbutton img.hover').hide();
	$('a.hoverbutton').hover(function() {
		$(this).find('img').hide();
		$(this).find('img.hover').show();
	}, function() {
		$(this).find('img').show();
		$(this).find('img.hover').hide();
	});
	
	
	
		var newwidth = $('#gallery #slider ul li').size() * 240;
	$('#gallery #slider ul').css({"width":newwidth});
	
	$('ul#nav li:last').css({"borderRight":"0"});
	
	
	$('#gallery #slider ul li a').hover(function() {
		$(this).find('span').hide();
	}, function() {
		$(this).find('span').hide();
	});
	
	
	$('#contact .your-name input').focus(function() {
		if($(this).attr("value") == "Your Name") { $(this).attr("value",""); }
	});
	$('#contact .your-name input').blur(function() {
		if($(this).attr("value") == "") { $(this).attr("value","Your Name"); }
	});
	$('#contact .your-email input').focus(function() {
		if($(this).attr("value") == "Email address") { $(this).attr("value",""); }
	});
	$('#contact .your-email input').blur(function() {
		if($(this).attr("value") == "") { $(this).attr("value","Email address"); }
	});
	$('#contact .your-message textarea').focus(function() {
		if($(this).attr("value") == "Anything else?") { $(this).attr("value",""); }
	});
	$('#contact .your-message textarea').blur(function() {
		if($(this).attr("value") == "") { $(this).attr("value","Anything else?"); }
	});
	
	$('input#mce-EMAIL').focus(function() {
		if($(this).attr("value") == "Your email address") { $(this).attr("value",""); }
	});
	$('input#mce-EMAIL').blur(function() {
		if($(this).attr("value") == "") { $(this).attr("value","Your email address"); }
	});
	
	$('.servicestabs .right a.webdesign_tab_link').click(function() {
		$('.servicestabs .right a').removeClass('active_tab');
		$(this).addClass('active_tab');
		$('.servicestabs .content .marketing_tab').animate({"left":"-1000px", "opacity":"0"}, 1000);
		$('.servicestabs .content .graphic_tab').animate({"left":"-1000px", "opacity":"0"}), 1000;
		$('.servicestabs .content .webdesign_tab').css({"left":"1000px", "opacity":"0"});
		$('.servicestabs .content .webdesign_tab').animate({"left":"0", "opacity":"1"}, 1000);
		return false;
	});
	
	$('.servicestabs .right a.marketing_tab_link').click(function() {
		$('.servicestabs .right a').removeClass('active_tab');
		$(this).addClass('active_tab');
		$('.servicestabs .content .webdesign_tab').animate({"left":"-1000px", "opacity":"0"}, 1000);
		$('.servicestabs .content .graphic_tab').animate({"left":"-1000px", "opacity":"0"}, 1000);
		$('.servicestabs .content .marketing_tab').css({"left":"1000px", "opacity":"0"});
		$('.servicestabs .content .marketing_tab').animate({"left":"0", "opacity":"1"}, 1000);
		return false;
	});
	
	$('.servicestabs .right a.graphic_tab_link').click(function() {
		$('.servicestabs .right a').removeClass('active_tab');
		$(this).addClass('active_tab');
		$('.servicestabs .content .marketing_tab').animate({"left":"-1000px", "opacity":"0"}, 1000);
		$('.servicestabs .content .webdesign_tab').animate({"left":"-1000px", "opacity":"0"}, 1000);
		$('.servicestabs .content .graphic_tab').css({"left":"1000px", "opacity":"0"});
		$('.servicestabs .content .graphic_tab').animate({"left":"0", "opacity":"1"}, 1000);
		return false;
	});
	
	
});
