$(document).ready(function(){

				
// Expand Panel
	$("#open").click(function(){
		$("div#panel").slideDown("slow");
	
	});	
	
	// Collapse Panel
	$("#close").click(function(){
		$("div#panel").slideUp("slow");	
	});		
	
	// Switch buttons from "Log In | Register" to "Close Panel" on click
	$("#toggle a").click(function () {
		$("#toggle a").toggle();
	});	

	// Advance Search
	$("#advS").click(function () {
		$(".totalvideos").css('display','none');
		$(".aSearch").css('display','block');
	});		
	$("#asclose").click(function () {
		$(".totalvideos").css('display','block');
		$(".aSearch").css('display','none');
	});		
			 
// Top Login Panel	 
			 
 $("#joincommunity").click(function() {
 $("#loginformdiv").addClass("displaynone");
 $("#registerformdiv").removeClass("displaynone");
   });
   
 $(".loginagain").click(function() {
 $("#loginformdiv").removeClass("displaynone");
 $("#registerformdiv").addClass("displaynone");
   });
   
    $(".lost-pwd").click(function() {
 $("#loginformdiv").addClass("displaynone");
 $("#lpformdiv").removeClass("displaynone");
   });


// Big search box
$("#searchform").submit(function() {	
var sq = $("#searchtext").val();	
var so1 = $("#dur").val();	
var so2 = $("#dateadded").val();
var len = sq.length;
if (len<2) { 
alert ('You must enter minimum 2 characters!'); return false; }
if (sq=='buscar videos porno') {
	alert ('You must enter search term!'); return false; }
sq = sq.replace(/ /g, "+");
var ur = "search-" + sq + '.html';	
if (so1=='1' && so2=='1') { 
$("#searchform").attr("action",ur); }
else {
var urll="search.php?search="+sq+"&dur="+so1+"&dateadded="+so2;	
$("#searchform").attr("action",urll); 	
}
});	

	$("#searchtext").focus(function() {
 var stvalue = $("#searchtext").val();
 if(stvalue=="buscar videos porno") {
 $("#searchtext").val('');
 }
});

$("#searchtext").focusout(function() {
 var stvalue = $("#searchtext").val();
 if(stvalue=="") {
 $("#searchtext").val('buscar videos porno');
 }
});


// Big search box
$("#sForm").submit(function() {	
var sq = $("#searchtext").val();	
var len = sq.length;
if (len<2) { 
alert ('You must enter minimum 2 characters!'); return false; }
if (sq=='buscar videos porno') {
alert ('You must enter search term!'); return false; }
sq = sq.replace(/ /g, "+");
var ur = "search-" + sq + '.html';	
$("#sForm").attr("action",ur); 	
});	

$("#sForm").focus(function() {
 var stvalue = $("#searchtext").val();
 if(stvalue=="buscar videos porno") {
 $("#searchtext").val('');
 }
});

$("#sForm").focusout(function() {
 var stvalue = $("#searchtext").val();
 if(stvalue=="") {
 $("#searchtext").val('buscar videos porno');
 }
});

		// internal bookamrks
$.fn.addbook = function(id,user) {
    var url = "includes/skybookmark.php";
	var rodja=$('#internalresponse');
	$(rodja).html("loading...");					   
	$.get(
	url,
	{utd:id,utser:user},
	function(response) { $(rodja).html(response); },
	"html");
	};
	
	
$.fn.removebook = function(id,user) {
    var url = "includes/skybookmark.php";
	var rodja=$('#internalresponse');
	$(rodja).html("loading...");	
	$.get(
	url,
	{utd:id,utser:user,what:"remove"},
	function(response) { $(rodja).html(response); },
	"html");
	};
		
 $("#unselect").click(function() {
	$('input:checkbox').each( function() {
     this.checked = !this.checked;
});
   });
   		
		// Search Form Chrome Fix
		
		
		$("#searchtext").focus(function() {
			$("#searchtext").css("-webkit-box-shadow","none");	});
		
		
		$(".pembed").hover(function() {
			$(".pembed").css("-webkit-box-shadow","none");	});
		
			$(".search-wrapper").css("-webkit-box-shadow","none");
			$(".search-field").css("-webkit-box-shadow","none");

		
		$("#searchtext").hover(function() {
			$(".advsrch").css("display","block").stop();	});	

		// Opera Fix
		
if (window.opera) {
   $('#toppanel').css('left','820px');
   $('.slide-out-div').css('width','180px');
   $('.button').css('background','black');
}


});
