$(document).ready(function() {
	
	
	
	if ($.browser.opera) {
		$(".btn-blue").addClass("opera-fix-bluebtn");
		//return true
		//alert("");
	 }	
	
	//alert($().jquery); //check what version of jquery is working
	// match heights
	$(".services").maxHeight();
	// related topics
	$("#related-show").click(function(){
		$(".related-topics-list").slideToggle("fast");
		$(".arrow-blue-down").toggleClass("arrow-blue-up");
	});
	
	$(".knock-out-guarantees").scrollable({
		easing : "swing",
		speed: 700
	});
	$(".knock-out-guarantees-inner").scrollable({
		easing : "swing",
		speed: 700
	});	
	$(".scroll-tabs").scrollable().navigator();
	
	$(".news-resource-panel").scrollable({
		easing : "swing",
		speed: 700
	});

	$(".scroll-tabs ul").tabs(".panes > div", {effect: 'fade', rotate: true}).click(function(){
		if (api.getIndex() == 0){$(".scroller-left").hide();}
			else if (api.getIndex() >= $(".scroll-tabs li:last").index()){$(".scroller-right").hide(); $(".scroller-left").show();}
			else if($(".scroll-tabs li:last").index() == 4){ $(".scroller-right, .scroller-left").hide(); }
				else {
					$(".scroller-left").show();
					$(".scroller-right").show();
				}
		
	});

	var api = $(".scroll-tabs ul").data("tabs");
	var api3 = $(".scroll-tabs").data("scrollable");
	
	if ($("#slider").attr("class") == "workSlider"  ){ 
		if (api.getIndex() == 7){$(".scroller-left").hide();}
		if ($(".scroll-tabs li:last").index() == 7)
		{
			//$(".scroller-left, .tab-right, .scroller-right, .tab-left").hide();
			$(".tab-right, .tab-left").hide();
			$(".scroller-left, .scroller-right").show();
		};
		$('.scroller-right').bind('click', function() {
			$(".scroll-tabs ul").css({'position':'static'});
		});
		setInterval(function() {
			$('.scroller-right').trigger('click');
			//$(".scroller-left, .tab-right, .scroller-right, .tab-left").hide();
			$(".tab-right, .tab-left").hide();
			$(".scroller-left, .scroller-right").show();			
		}, 9000);

		$(".scroll-tabs ul li").click(function(){
			window.location=$(this).find("a").attr("href"); 
			return true;
		});
	};

	

	var api2 = $(".scroll-tabs").data("scrollable");

	
	// "next tab" button
	$(".scroller-right").click(function() {
		api.next();
		api2.next();
		$(".scroller-left").show();
		if (api.getIndex() == $(".scroll-tabs li:last").index()) {
			$(".scroller-right").hide();
		}
		else {
			$(".scroller-right").show();
		}
	});
	
	// "previous tab" button
	$(".scroller-left").click(function() {
		api.prev();
		api2.prev();
		if ($(".scroll-tabs li:last").index() == 4)
		{
			$(this).hide();
		} else {
			$(this).show();
		}
		
		if (api.getIndex() == 0) {
			$(this).hide();
		}
		else {
			$(".scroller-right").show();
		}		
	});
	

	
	
	$(".tabs-features > ul").tabs(".panel-features > div");
	
	//$("#features-accordion").tabs("#features-accordion div.pane", {tabs: 'h2', effect: 'slide', initialIndex: 0, current: "currentTab"})
	
	$(".our-knockout-guarantees").tabs(".our-knockout-guarantees div.pane-details", {tabs: 'h2', effect: 'slide', initialIndex: 0, current: "currentOKG"})
	
	$(".okg-features").tabs(".okg-features div.pane-details", {tabs: 'h2', effect: 'slide', initialIndex: 0, current: "currentOKG"})
	
	$(".unbeatable-feature").tabs(".unbeatable-feature div.pane-uf-details", {tabs: 'h3', effect: 'slide', initialIndex: 0, current: "currentUF"})
	
	$(".compare-us-page").tabs(".compare-us-page div", {tabs: 'h2', effect: 'slide', initialIndex: 0, current: "currentCU"})	
	
	/* Active Menu */
	if ($("body").attr("id") == "home"  ){ $(".home-page").addClass("activeMenu"); };
	if ($("body").attr("id") == "essay" ){ $(".essay-page").addClass("activeMenu"); };
	if ($("body").attr("id") == "coursework"  ){ $(".coursework-page").addClass("activeMenu"); };
	if ($("body").attr("id") == "researchpaper"  ){ $(".researchpaper-page").addClass("activeMenu"); };
	if ($("body").attr("id") == "thesis"  ){ $(".thesis-page").addClass("activeMenu"); };
	if ($("body").attr("id") == "dissertation"  ){ $(".dissertation-page").addClass("activeMenu"); };
	if ($("body").attr("id") == "assignment"  ){ $(".assignment-page").addClass("activeMenu"); };
	if ($("body").attr("id") == "bookreport"  ){ $(".bookreport-page").addClass("activeMenu"); };
	if ($("body").attr("id") == "stats-assignment"  ){ $(".stats-page").addClass("activeMenu"); };
	if ($("body").attr("id") == "physic-assignment"  ){ $(".physic-page").addClass("activeMenu"); };
	if ($("body").attr("id") == "maths-assignment"  ){ $(".maths-page").addClass("activeMenu"); };
	if ($("body").attr("id") == "accounts-assignment"  ){ $(".accounts-page").addClass("activeMenu"); };
	if ($("body").attr("id") == "computer-assignment"  ){ $(".computer-page").addClass("activeMenu"); };
	if ($("body").attr("id") == "admission-essay"  ){ $(".admission-essay-page").addClass("activeMenu"); };
	if ($("body").attr("id") == "book-review"  ){ $(".book-review-page").addClass("activeMenu"); };
	if ($("body").attr("id") == "orderpages"  ){ $(".essay-page, .termpaper-page, .researchpaper-page, .thesis-page, .dissertation-page, .assignment-page, .all-services").addClass("hide"); };
	//if ($("body#essay")){ };
	//if ($("body#essay")){ };				

	$(".pages").cycle({
		fx:     'slideY', 
		speed:  'fast', 
		timeout: 0, 
		next:   '.next', 
		prev:   '.prev' 	
	});
	
	$(".showchaps").click(
		function() {
			$(".chapt").slideToggle();
		}
	);
	$(".assingment-features").find("li a").after("&nbsp;<img src='/assets/images/link-out.gif' align='middle' />");

	// Pricing Page 	
	$(".pricing-page tr:odd").addClass("odd");
	$(".student-login tr:odd").addClass("odd");
	
	// sub menu 
	$("#sidebar > .sub-menu").appendTo("#sidebar");


	
});
/* CUFON */
Cufon.replace('.main-menu a', { fontFamily: 'HelveticaNeueLiteMed' , hover: true});
Cufon.replace('.box h1, .endess-knockout-guarantees .header, .endess-knockout-guarantees-inner .header, .writers-make-sure, .confidential-custom h1, .tabs-features li a, .included-features h1, .included-features h2, .start-head h1, .exclusive-offer h1,#conditions h5, .error-page h1, .custom-dissertaion h2, .custom-dissertaion ul li, .order-online h1, .order-by-phone h1, .order-by-chat h1, .order-by-chat p, .order-by-phone p, .process-steps h1, .process-steps h2, .included-features-inner h1, .included-features-inner h1, .instant-price-q h1, .quote-online h1, .highslide-pop-outer h1, .contact-us h2, .services-we-provide h1, .step-description h3, .industry h1, .industry-warning h6, .industry-steps .step h3, .confidential-custom h2, .box-platinum h3, .container-body h3', { fontFamily: 'HelveticaNeueLiteRoman' , hover: true});
Cufon.replace('.scroll-tabs li a, .scroll-tabs-snp li a', { fontFamily: 'HelveticaNeueLiteMed' , hover: true , textShadow: '1px 2px rgba(0, 0, 0, 1s)' });

function closewind(obj)
{	
return hs.close(obj);
}



