// JavaScript Document


$(function(){  // JQuery function Start
  
           $("#join_model").validationEngine({  
				success :  false, 
				failure : function() {}
			});
		   
		   $("#join_agency").validationEngine({  
				success :  false, 
				failure : function() {}
			});
		   
		   $("#login").validationEngine({  
				success :  false, 
				failure : function() {}
			});
		   
		   $("#add_photographer").validationEngine({  
				success :  false, 
				failure : function() {}
			});
			
		     
		  //  $("img").lazyload({ placeholder : "http://www.theamazingmodels.com/images/ajax-loader.gif" });


		  $('#add-friend').click(function() {
			 /*$('#loading_editcategory').show();
			  $.ajax({
				  type: "POST",  
				  url: "addcat.php",  
				  data: "stype=editcategoryselect&catid=" + $(this).val(),
				  success: function(html) {
					  $('#loading_editcategory').hide();
					  $("div#editshowcategory").html(html);
				 }							 
			}); */
			  alert("test");
		});






		   
 }); // JQuery function End




function set_model_viewlist(do_check)  
{
	var elts      = document.getElementsByName('models_checkbox[]'); 
    var elts_cnt  = elts.length;	
    for (var i = 0; i < elts_cnt; i++){
        elts[i].checked = do_check;
	 } 
	    return true; 
} 

function set_agency_viewlist(do_check)  
{
	var elts      = document.getElementsByName('agency_checkbox[]'); 
    var elts_cnt  = elts.length;	
    for (var i = 0; i < elts_cnt; i++){
        elts[i].checked = do_check;
	 } 
	    return true; 
} 


function set_designers_viewlist(do_check)  
{
	var elts      = document.getElementsByName('designers_checkbox[]'); 
    var elts_cnt  = elts.length;	
    for (var i = 0; i < elts_cnt; i++){
        elts[i].checked = do_check;
	 } 
	    return true; 
} 


function postcomments(id,type) {
	
	
		
		$(document).ready(function()
								  {
									 document.getElementById('bg-sad').style.display="block";
									 $("div#one1").slideDown("slow");  
								   });
	
	
}

function closepost(){
	
	$(document).ready(function()
								   {
									 $("div#one1").slideUp("slow");  
									 document.getElementById('bg-sad').style.display="none";
								   });
}



function modelcompose() {
	
		
		$(document).ready(function()
								   {
									 $("div#composemsg").slideDown("slow");  
								   });
	}
	
function closemodelcompose(){
	
	$(document).ready(function()
								   {
									 $("div#composemsg").slideUp("slow");  
								   });
	window.location="http://www.theamazingmodels.com/top-models-profiles.php";
}


function agencycompose() {
	
		
		$(document).ready(function()
								   {
									 $("div#composemsg0").slideDown("slow");  
								   });
	}


function closeagencycompose(){
	
	$(document).ready(function()
								   {
									 $("div#composemsg0").slideUp("slow");  
								   });
}


function designercompose() {
	
		
		$(document).ready(function()
								   {
									 $("div#composemsg1").slideDown("slow");  
								   });
	}


function closedesignercompose(){
	
	$(document).ready(function()
								   {
									 $("div#composemsg1").slideUp("slow");  
								   });
}


function replymsg() {
	
		
		$(document).ready(function()
								   {
									 $("div#replymessage").slideDown("slow");  
								   });
	}


function closereplymsg(){
	
	$(document).ready(function()
								   {
									 $("div#replymessage").slideUp("slow");  
								   });
}



function replycomment(id) {
	
	  
		$(document).ready(function()
								   { 
		$("div#reply-"+id).fadeIn("slow"); 						   
	   // $("div#reply").css("width", "600px");
		//$("div#reply").css("height", "500px");					   
		//$("div#reply").css("top", ( $(window).height() - $("div#reply-"+id).height() ) / 2+$(window).scrollTop() + "px");
		//$("div#reply").show("slow");
								   });
}

function closerepcomment(id) {
	
	$(document).ready(function()
								   {
									 $("div#reply-"+id).fadeOut("slow");  
								   });
	window.location="http://www.theamazingmodels.com/approve-comments.php";

}



function contactmodels(id,type,modid) {
	
	if(id == '' ){
		
		alert("Please Login");
	}
	
	else {
		
		$(document).ready(function()
								   {
									 $("div#contactmodels-"+modid).show("slow");  
								   });
	}
	
}



function closecontactmodels(modid) {
	
	$(document).ready(function()
								   {
									 $("div#contactmodels-"+modid).hide("slow");  
								   });
}



function reply() {
	
	  
		$(document).ready(function()
								   {  
									 $("div#reply").fadeIn("slow");  
								   });
		document.getElementById('one').style.display = "block";
}


function postagencycomments(id,type) {
	
	if(id == '' ){
		
		alert("Please Login:");
	}
	
	else {
		
		$(document).ready(function()
								   {
									 $("div#agencypost").slideDown("slow");  
								   });
	}
	
}

function closeagencypost() {
	
		$(document).ready(function()
								   {
									 $("div#agencypost").slideUp("slow");  
								   });
} 


function agencyreplycomment(id) {
	  
		$(document).ready(function()
								  {  
									 $("div#replyagencycomment-"+id).fadeIn("slow");  
								   });
}

function closeagencyreplycomment(id) {
	
	$(document).ready(function()
								   {
									 $("div#replyagencycomment-"+id).fadeOut("slow");  
								   });
	window.location="http://www.theamazingmodels.com/approve-agency-comments.php";

}



function contactmodels(id,type,agnid) {
	
	if(id == '' ){
		
		alert("Please Login");
	}
	
	else {
		
		$(document).ready(function()
								   {
									 $("div#contactagency-"+agnid).show("slow");  
								   });
	}
	
}



function closecontactmodels(agnid) {
	
	 $(document).ready(function()
	 {
	   $("div#contactagency-"+agnid).hide("slow"); 
	 });
}


function formvalidate() {
	
   var regex = /^([a-zA-Z0-9_\.\-])+\@(([a-zA-Z0-9\-])+\.)+([a-zA-Z0-9]{2,4})+$/;
   
	if(document.getElementById('name1').value=="") 
					{
					alert("Enter your name");
					return false; 
					}
	else if(document.getElementById('mymailid').value=="") 
					{
					alert("Enter Your mailid"); 
					return false; 
					}
	else if(!regex.test(document.getElementById('mymailid').value))
				{
				alert("Please enter Valid mailid");
				return false;
				} 
	else if(document.getElementById('fndmail2').value=="") 
				{
				alert("Enter Your Friend's mailid"); 
				return false; 
				}
	else if(!regex.test(document.getElementById('fndmail2').value))
				{
				alert("Please enter Valid Friend's mailid");
				return false;
				} 
	else if(document.getElementById('confirm').value=="") 
					{
					alert("This field is required");
					return false; 
					}	
	else if((document.getElementById('confirm').value) != (document.getElementById('password').value)) 
					{
					alert("your answer is not matching");
					return false; 
					}		
				
	else    
	{
	document.error.submit();   
	return true;    
	}   
 } 
 
 
 function linkexchange_validate() {
	 
	var regex = /^([a-zA-Z0-9_\.\-])+\@(([a-zA-Z0-9\-])+\.)+([a-zA-Z0-9]{2,4})+$/;
	var urlregex = new RegExp("^(http:\/\/www.|https:\/\/www.|ftp:\/\/www.|www.){1}([0-9A-Za-z]+\.)");
	
	if(document.getElementById('title').value=="") {
	alert("Please Enter Your Site Title");    
	return false;  
    }
    else if(document.getElementById('url').value=="") {
    alert("Enter Your site url");
    return false; 
    }
    else if(!urlregex.test(document.getElementById('url').value)) {
    alert("PLease enter the Valid Site Url");
    return false;
    } 
    else if(document.getElementById('des').value=="") {
    alert("Enter Site Description");
    return false; 
    } 
    else if(document.getElementById('category').value=="") {
    alert("Please Select Category");
    return false; 
    } 
    else if(document.getElementById('link').value==""){
    alert("Reciprocal link is must");
    return false; 
    } 
    else if(document.getElementById('name1').value=="") {
    alert("Enter Your Name");
    return false; 
    } 
    else if(document.getElementById('mail').value=="") {
    alert("Enter Your Email id");
    return false; 
    } 			  
    else if(!regex.test(document.getElementById('mail').value)) {
    alert("PLease enter the Valid Email");
    return false;
    }  
    else if(document.getElementById('confirm').value=="") {
    alert("This field is must");
    return false; 
    } 
	else if((document.getElementById('confirm').value) != (document.getElementById('password').value)) { 
	alert("Try again please");
	return false; 
    } 				  
	else    
	{
	document.tell.submit();   
    return true;    
    }   
 }   

function errorreport_validate() {
	
	var regex = /^([a-zA-Z0-9_\.\-])+\@(([a-zA-Z0-9\-])+\.)+([a-zA-Z0-9]{2,4})+$/;
	
	if(document.getElementById('name1').value=="") {
    alert("Enter your name ");
    return false; 
    }
				                             	
   else if(document.getElementById('email').value=="") {
   alert("Enter Your mailid");
   return false; 
   }
   
   else if(!regex.test(document.getElementById('email').value)) {
   alert("Please enter a Valid Email");
   return false;
   } 
   else if(document.getElementById('link').value=="") {
   alert("Please enter the url of the page that has an error.");
   return false; 
   }
   else if(document.getElementById('comments').value=="") 
   {
   alert("Please enter the error that you have found.");
   return false; 
   }
   else {
   document.error.submit();   
   return true;    
   }
   
}


  function validate_postcomment() {
	 if(document.getElementById('names').value==""){
		  alert("Enter your Name");
		  return false; 
	 }else if(document.getElementById('comments').value=="") {
		  alert("Enter Your Comments"); 
		  return false; 
	 }else if( document.getElementById('password').value != document.getElementById('confirm').value){
		  alert("Entered Wrong Sum value");
		  return false; 
	 }else{
		  document.post_comments.submit();   
		  return true;    
	 }   
  } 
	   
  function Qs_model(){
	get_keyword= document.getElementById('Qs_keyword').value;
	window.location = "http://www.theamazingmodels.com/model-search.php?search-type=keyword&keyword="+get_keyword;
  }








