function popreset() {
    stopBrowser();
	$("#create-popup").attr("src", '');
    $(".cracker-popout").slideUp("slow");
    $("#create-popup, #industry-warning, #testimonial, .call-back-small, .order-now-small, .call-back-top, .order-now-top, .assignment-inner, .box-details").hide();
    $("*").removeClass("click-active")
}
function stopBrowser() {
    if ($.browser.msie) {
			  document.execCommand("Stop");
			      return false;
	} 
	else {
			window.stop();
			    return false;
	}

}

function swaptabs() {
    var a = $(".pane .active").next(),
        b = $(".pane .active");
    if (b.is(":last-child")) a = $(".pane div:first-child");
    b.is(":first-child") && $(".tabs").addClass("current");
    $(".pane div").fadeTo("fast", "0", function () {
        $(".pane div").removeClass("active").addClass("hideMe");
        a.fadeTo("slow", "1").addClass("active").removeClass("hideMe")
    })
}
function tb1swp() {
    $(".tabs").removeClass("current")
};

// Tabs Rotate Function Ends here
$(document).ready(function () {

    // Page Check
    // ----------
    if ($("body").attr("id") == "home") {
        $(".home-page").addClass("active");
		$(".page-name").html("Paper ");

    };
    if ($("body").attr("id") == "essays") {
        $(".essays-page").addClass("active");
		$(".page-name").html("Essays ");		

    };
    if ($("body").attr("id") == "course-work") {
        $(".course-work-page").addClass("active");
		$(".page-name").html("Coursework");		

    };
    if ($("body").attr("id") == "research-papers") {
        $(".research-papers-page").addClass("active");
		$(".page-name").html("Research Paper ");		

    };
    if ($("body").attr("id") == "theses") {
        $(".theses-page").addClass("active");
		$(".page-name").html("Thesis ");		
    };
    if ($("body").attr("id") == "disseration") {
        $(".disseration-page").addClass("active");
		$(".page-name").html("Disseration ");		

    };
    if ($("body").attr("id") == "assingment") {
        $(".assingment-page").addClass("active");
		$(".page-name").html("Assignment ");		

    };
    if ($("body").attr("id") == "book-report") {
		$(".page-name").html("Book Report ");		
    };
    if ($("body").attr("id") == "labreport") {
		$(".page-name").html("Labreport ");		
    };
    if ($("body").attr("id") == ""){
		$(".page-name").html("Paper ");		
    };
	
    if ($("body").attr("id") == "power-point-presentation"){
		$(".page-name").html("Presentation ");		
    };	
	
    if ($("body").attr("id") == "thesis-proposal"){
		$(".page-name").html("Proposal ");		
    };		
    if ($("body").attr("id") == "research-proposal"){
		$(".page-name").html("Proposal ");		
    };			


    // Tabs Switch 
    var divwap = setInterval('swaptabs()', 5000);
    var tab1swap = setInterval('tb1swp()', 10000);

    // Manual Tab Switch
    $("#product-feature").click(function () {
        $(".tab-container1").fadeTo("slow", "1").addClass("active").removeClass("hideMe");
        $(".tab-container2").hide();
        $(".tabs").removeClass("current");
        clearInterval(divwap);
        clearInterval(tab1swap);
    });
    $("#service-feature").click(function () {
        $(".tab-container2").fadeTo("slow", "1").addClass("active").removeClass("hideMe");
        $(".tab-container1").hide();
        $(".tabs").addClass("current");
        clearInterval(divwap);
        clearInterval(tab1swap);
    });

    // Dog Ear
    $("#dog-ear").prependTo($('body'));
    $("#dog-ear").hover(function () {
        $(this).animate({
            left: '0'
        });
    }, function () {
        $(this).animate({
            left: '-10px'
        });
    });
    ShowMe();

    function ShowMe() {
        setInterval(function () {
            $("#dog-ear").animate({
                left: '-10px'
            });
        }, 5000);
    }

    // News Scroll
    $(".news-arrow-right").click(function () {
        $(".news-listing ul").animate({
            right: 665
        }, 500);
        $(".chk2").addClass("chk");
        $(".chk1").removeClass("chk");
    });
    $(".news-arrow-left").click(function () {
        $(".news-listing ul").animate({
            right: 0
        }, 500);
        $(".chk1").addClass("chk");
        $(".chk2").removeClass("chk");
    });

    // Crackers 
    $(".current-offers").click(function () {
        popreset();
        $(".cracker-popout").slideDown('slow');
    });
    $(".close-me").click(function () {
        $(".cracker-popout").slideUp('slow');
    });
    // Pop Up Close
    $(".btn-close").click(function () {
        stopBrowser();
        $("#create-popup, #industry-warning, #testimonial, .call-back-small, .order-now-small, .order-now-small-lp, .call-back-top, .order-now-top, order-now-top2, .assignment-inner, .box-details").hide();
        $("*").removeClass("click-active");
        $("#create-popup").attr("src", '');
        $("#testi-popup").attr("src", '');


    });
    $(".btn-close2").click(function () {
        $(".order-now-small-inner").hide();
		$(".call-back-small-inner").hide();
    });

    // Create Pop-Up Here 
    $(".popupMe").click(function () {
        popreset();
        $("#create-popup").show();
        $(this).addClass("click-active");
        setURL = $(".membership-discount a").attr("href");
        $("#popurl").attr("src", setURL);

    });	
	$(".loan-program").click(function () {
        popreset();
        $("#create-popup").show();
        $(this).addClass("click-active");
        setURL = $(".loan-program a").attr("href");
        $("#popurl").attr("src", setURL);

    });
    $(".membership-discount").click(function () {
        popreset();
        $("#create-popup").show();
        $(this).addClass("click-active");
        setURL = $(".membership-discount a").attr("href");
        $("#popurl").attr("src", setURL);

    });
    $(".out-quality").click(function () {
        popreset();
        $("#create-popup").show();
        $(this).addClass("click-active");
        setURL = $(".out-quality a").attr("href");
        $("#popurl").attr("src", setURL);
    });
    $(".why-choose").click(function () {
        popreset();
        $("#create-popup").show();
        $(this).addClass("click-active");
        setURL = $(".why-choose a").attr("href");
        $("#popurl").attr("src", setURL);
    });
    $(".process-tag").click(function () {
        popreset();
        $("#create-popup").show();
        $(this).addClass("click-active");
        setURL = $(".process-tag a").attr("href");
        $("#popurl").attr("src", setURL);
    });
    $(".knock-out-tag").click(function () {
        popreset();
        $("#create-popup").show();
        $(this).addClass("click-active");
        setURL = $(".knock-out-tag a").attr("href");
        $("#popurl").attr("src", setURL);
    });
    $(".pcal-on").click(function () {
        popreset();
        $("#create-popup").show();
        setURL = $(".pcal-on a").attr("href");
        $("#popurl").attr("src", setURL);
    });
    $(".industry-warning").click(function () {
        popreset();
        $("#industry-warning").show();
        $(this).addClass("click-active");
    });
    $(".showThesis").click(function () {
        $(".thesisB").show();
    });
    $(".showDissertation").click(function () {
        $(".dissertationB").show();
    });
	$(".showPpt").click(function () {
        $(".ppt").show();
    });
	$(".showThesisP").click(function () {
        $(".thesisP").show();
    });	
	$(".showRP").click(function () {
        $(".researchP").show();
    });		
	
	// assingment page popups
	
	$(".m-as").click(function(){
		$(".math-assignment").show();
	});
	$(".p-as").click(function(){
		$(".physic-assingment").show();
	});	
	$(".s-as").click(function(){
		$(".stats-assingment").show();
	});		
	$(".a-as").click(function(){
		$(".acc-assingment").show();
	});		
    // Sub Menu 
    var hide = false;

    // ABOUT MENU 
    $(".submenu-show").hover(function () {
        if (hide) clearTimeout(hide);
        $(".sub-menu").show();
        $('.submenu-show a').addClass('active');
    }, function () {
        hide = setTimeout(function () {
            $(".sub-menu").hide();
        });
        $('.submenu-show a').removeClass('active');
    });
    $(".sub-menu").hover(function () {
        if (hide) clearTimeout(hide);
        $('.submenu-show a').addClass('active');
    }, function () {
        hide = setTimeout(function () {
            $(".sub-menu").hide();
        });
        $(".sub-menu").stop().show();
        $('.submenu-show a').removeClass('active');
    });


    // services , cracker , process url swtich
    // type A
    if ($("body").attr("class") == "typeA") {
        //alert('Type A');
        $(".crackerURL").attr("src", "/assets2/images/offers/cracker-type-1.png");
        $(".process-tag a").attr("href", "/inc2/banner/process-A.html");
        $(".typeA").removeClass("hide");
    }
    if ($("body").attr("class") == "typeB") {
        $(".crackerURL").attr("src", "/assets2/images/offers/cracker-type-2.png");
        $(".process-tag a").attr("href", "/inc2/banner/process-B.html");
        $(".typeB").removeClass("hide");
    }
    if ($("body").attr("class") == "typeC") {
        $(".crackerURL").attr("src", "/assets2/images/offers/cracker-type-3.png");
        $(".process-tag a").attr("href", "/inc2/banner/process-C.html");
        $(".typeC").removeClass("hide");
    }
    if ($("body").attr("class") == "typeD") {
        $(".crackerURL").attr("src", "/assets2/images/offers/cracker-type-4.png");
        $(".process-tag a").attr("href", "/inc2/banner/process-D.html");
        $(".typeD").removeClass("hide");
        $(".HidePaperPPT").addClass("hide");		
		
    }
    if ($("body").attr("class") == "typeE") {
        $(".crackerURL").attr("src", "/assets2/images/offers/cracker-type-2.png");
        $(".process-tag a").attr("href", "/inc2/banner/process-E.html");
        $(".typeB").removeClass("hide");
    }

    // Testimonial Popup
 //   $(".main-content-containter").append('<div class="listen-testimonial"><a href="javascript:;"><img src="/assets2/images/btn-listen-testimonials.gif" alt="" /></a></div>');

//    $(".listen-testimonial").click(function () {
//        $("#testimonial").show();
//        if ($("body").attr("id") == "home") {
//            $("#testi-popup").attr("src", '/testimonials/testimonial_5.html');
//        };
//        if ($("body").attr("id") == "essays") {
//            $("#testi-popup").attr("src", '/testimonials/testimonial_2.html');
//
//        };
//        if ($("body").attr("id") == "course-work") {
//            $("#testi-popup").attr("src", '/testimonials/testimonial_7.html');
//
//        };
//        if ($("body").attr("id") == "research-papers") {
//            $("#testi-popup").attr("src", '/testimonials/testimonial_3.html');
//
//        };
//        if ($("body").attr("id") == "theses") {
//            $("#testi-popup").attr("src", '/testimonials/testimonial_4.html');
//
//        };
//        if ($("body").attr("id") == "disseration") {
//            $("#testi-popup").attr("src", '/testimonials/testimonial_8.html');
//
//        };
//        if ($("body").attr("id") == "assingment") {
//            $("#testi-popup").attr("src", '/testimonials/testimonial_5.html');
//
//        };
//    });


    /* Request Call Back */
    $(".rc-small").click(function (e) {
        popreset();
        setURL = $(this).attr("href");
        $("#call-back-small-frame").attr("src", setURL);
        var offset = $(this).offset();
        $(".call-back-small").show().css({
            top: offset.top - 487
        });
    });
	
    $(".rc-top").click(function (e) {
        popreset();
        setURL = $(this).attr("href");
        $("#call-back-top-frame").attr("src", setURL);
        var offset = $(this).offset();
        $(".call-back-top").show().css({
            top: offset.top
        });
    });	
    $(".order-now-pop").click(function (e) {
        popreset();
        setURL = $(this).attr("href");
        $("#order-now-small-frame").attr("src", setURL);
        var offset = $(this).offset();
        if ($.browser.msie) {
            var valordersmall = 326;
        } else {
            var valordersmall = 367;
        }
        $(".order-now-small").show().css({
            top: 96
        });
    });
	
	  $(".order-now-pop-lp").click(function (e) {
        popreset();
        setURL = $(this).attr("href");
        $("#order-now-small-frame").attr("src", setURL);
        var offset = $(this).offset();
        if ($.browser.msie) {
            var valordersmall = 326;
        } else {
            var valordersmall = 367;
        }
        $(".order-now-small-lp").show().css({
            top: 96
        });
    });
	
	
    $(".order-now-pop-top").click(function (e) {
        popreset();
        setURL = $(this).attr("href");
        $("#order-now-top-frame").attr("src", setURL);
        var offset = $(this).offset();
        $(".order-now-top").show().css({
            top: offset.top
        });
		
    });		
	 $(".order-now-pop-top2").click(function (e) {
        popreset();
        setURL = $(this).attr("href");
        $("#order-now-top-frame").attr("src", setURL);
        var offset = $(this).offset();
        $(".order-now-top").show().css({
            top: 80
        });
		
    });		
});


