$(document).ready(function(){

//clear fix after
	$(".cl").parent().append('<div class="cf"></div>');
	
// modify margin
	$(".desc p:last-child").addClass("last");
	
//slider
	$('#slide1').nivoSlider();
	$('#slide2').nivoSlider();

//selectbox
	$(".select-search").selectbox();

//breadcrumb
	$("#breadCrumb3").jBreadCrumb();
	
//faq
	$('ul#faqList').simpleFAQ();	
	$('ul#faqList').bind('show.simpleFAQ', function(jQEvent, faqNode) {});
	
//overlay
	$(".overlay").fadeTo("slow", 0.7); // This sets the opacity of the thumbs to fade down to 30% when the page loads
    $(".overlay").hover(function(){
    $(this).fadeTo("slow", 1.0); // This should set the opacity to 100% on hover
    },function(){
    $(this).fadeTo("slow", 0.8); // This should set the opacity back to 30% on mouseout
    });
	
//Bloked mouse hover
	$("#bt-sub li, .list-news li").click(function(){
		window.location=$(this).find("a").attr("href");return false;
	});	

	$(".list-content li").mouseover(function() {
		$(this).css('backgroundColor','#f5f5f5');
	}).mouseout(function() {
		$(this).css('backgroundColor','');	
	})
/*						   
//slider1
    $('#slide1').cycle({
		fx: 'scrollLeft',
		speed:   500,
		timeout: 8000,
		delay:  2000,
		pause: 1, 
   		pager:  '.pageslide1' 
	});

//slider2
    $('#slide2').before('<div id="nav2">').cycle({
		fx: 'scrollLeft',
		speed:   500,
		timeout: 8000,
		delay:  2000,
		pause: 1, 
   		pager:  '.pageslide2' 
	});
*/	

//slide3
	$("#list-news").jCarouselLite({
		vertical: true,
		hoverPause:true,
		visible: 3,
		auto:4000,
		speed:1000
	});	
	
//slide4
    $('#testimonial').cycle({
		fx: 'fade',
		speed:   500,
		timeout: 6000,
		delay:  -2000,
		pause: 1
	});
	
//tabs
	$("#tabs-container").tabs();
	
//corner	
	/*
	setting = {tl: { radius: 10 },	tr: { radius: 10 }, bl: { radius: 10 }, br: { radius: 10 }, antiAlias: true, autoPad: true, validTags: ["div"]}	
	$('.box-why, .bg-why, .image-logo').corner(setting);
	*/
	setting2 = {tl: { radius: 0 },	tr: { radius: 0 }, bl: { radius: 10 }, br: { radius: 10 }, antiAlias: true, autoPad: true, validTags: ["div"]}	
	$('.footer-bot .box-foot').corner(setting2);
	
//accordion		
	$(".accordion h3").eq(0).addClass("active");
	$(".accordion .accor_content").eq(0).show();
	$(".accordion h3").click(function(){
		$(this).next(".accor_content").slideToggle("slow")
		.siblings(".accor_content:visible").slideUp("slow");
		$(this).toggleClass("active");
		$(this).siblings("h3").removeClass("active");
	});

//treview
	$("#navigation").treeview({
	animated: "fast",
	persist: "location",
	collapsed: true,
	unique: true
	});
	
//ssl certificates
	$(".tab-ssl").hide(); //Hide all content
	$("ul.tab-sel li:first-child").addClass("active").show(); //Activate first tab
	$(".tab-ssl:first-child").show(); //Show first tab content
	
	//On Click Event
	$("ul.tab-sel li").hover(function() {
		$("ul.tab-sel li").removeClass("active"); //Remove any "active" class
		$(this).addClass("active"); //Add "active" class to selected tab
		$(".tab-ssl").hide(); //Hide all tab content
		var activeTab = $(this).find("a").attr("href"); //Find the rel attribute value to identify the active tab + content
		$(activeTab).show(); //Fade in the active content
		return false;
	});
	
	$(".bt-view a").click(function() {
		$('html, body').animate({
		scrollTop: $("#tabs-container").offset().top}, 1500);
	});
	
	//On mouse hover
	$(".pricing-table-list tr").mouseover(function() {
		$(this).css('backgroundColor','#DDF0FF');
	}).mouseout(function() {
		$(this).css('backgroundColor','');	
	});
	
	$(".promo-reseller tr").click(function(){
		window.location=$(this).find("a").attr("href");return false;
	}).mouseover(function() {
		$(this).css('backgroundColor','#C6EFA0');
	}).mouseout(function() {
		$(this).css('backgroundColor','');	
	});
		
//Validasi konfirmasi pembayaran
	$("#confirmForm").validate({
		rules: {
			nama: "required",
			email: {
				required: true,
				email: true
			},
			no_invoice: {
				required:true,
				number:true
			},
			jmlStr: "required",
			nmRek: "required",
			noRek: "required",
			tipe_transaksi: "required",
			code: {
				required: true,
				remote: "ajax_captcha.php"
			}
		},
		messages: {
			nama: "Mohon isi nama lengkap anda",
			email: "Masukkan alamat email valid anda",
			no_invoice: "Masukkan no invoice anda",
			jmlStr: "Jumlah transaksi anda",
			nmRek: "Masukkan nama rekening anda",
			noRek: "Masukkan no rekening anda",
			tipe_transaksi: "Pilih transaksi anda",
			code: "Tulislah huruf yang ada dikotak"
		}
	});
	
//Validasi kontak
	$("#kontakForm").validate({
		rules: {
			nama: "required",
			email: {
				required: true,
				email: true
			},
			tujuan: "required",
			jdl: "required",
			message: "required",
			code: {
				required: true,
				remote: "ajax_captcha.php"
			}
		},
		messages: {
			nama: "Mohon isi nama lengkap anda",
			email: "Masukkan alamat email valid anda",
			tujuan: "Pilih tujuan kontak anda",
			jdl: "Masukkan judul kontak anda",
			message: "Masukkan pesan yang ingin anda sampaikan",
			code: "Tulislah huruf yang ada dikotak"
		}
	});
	

});	

