//<li><a href="'.$c->photo_file_url.'" class="preview"><img width="80" height="70" src="'.$c->photo_file_url.'" title="'.$c->photo_title.'" /></a></li>"';
/*$.getJSON(url,function(j){ 
	var img_url='<ul>';
	var title='';
	var len=j.photos.length;
	for(var i=0; i<4; i++)
		{
			title=j.photos[i].photo_title;	
			img_url+='<li><a href="'+j.photos[i].photo_file_url+'" class="preview"><img  src="'+j.photos[i].photo_file_url+'" height="70" width="80" title="'+title+'" /></li>';	
		}
			title=j.photos[i].photo_title;	
			img_url+='<li><a href="'+j.photos[i].photo_file_url+'" class="preview"><img  src="'+j.photos[i].photo_file_url+'" height="70" width="80" title="'+title+'" /></li>';	
		   img_url+='</ul>';
		   alert(img_url);
		
		$("#city_image").html(img_url);
	});*/


/*$(document).ready(function(){
						   
$("#email").validate();	
 $("#send_mail").click(function()
{
 alert("OK");
  });
});*/

$(document).ready(function(){
imagePreview();	
$("#contact_us").validate();
$("#email_form").validate({
   submitHandler: function(form) {
	
		$.ajax({
				type:"POST",
				url:"send_mail.php",
				data:$("#email_form").serialize(),
				cache: false,
				success: function(msg)
				{
					
					$("#res_msg").html("");
					$("#res_msg").html("Your Mail has been send successfully");
					self.setTimeout('$("#res_msg").show().fadeOut("4500");',"2500");
					$("#city").val("");
					$('#email').val("");

					return false;
   				}
		});
		$("#res_msg").html("");
		$("#res_msg").show().fadeIn("fast");
		$("#res_msg").html("Sending...");
		

   }
 });
});

/*
 * Image preview script 
 * powered by jQuery (http://www.jquery.com)
 * 
 * written by Alen Grakalic (http://cssglobe.com)
 * 
 * for more info visit http://cssglobe.com/post/1695/easiest-tooltip-and-image-preview-using-jquery
 *
 */
 
this.imagePreview = function(){	
	/* CONFIG */
		
		xOffset = 10;
		yOffset = 30;
		
		// these 2 variable determine popup's distance from the cursor
		// you might want to adjust to get the right result
		
	/* END CONFIG */
	$("a.preview").hover(function(e){
		this.t = this.title;
		this.title = "";	
		var c = (this.t != "") ? "<br/>" + this.t : "";
		$("body").append("<p id='preview'><img src='"+ this.href +"' alt='Image preview' />"+ c +"</p>");								 
		$("#preview")
			.css("top",(e.pageY - xOffset) + "px")
			.css("left",(e.pageX + yOffset) + "px")
			.fadeIn("fast");						
    },
	function(){
		this.title = this.t;	
		$("#preview").remove();
    });	
	$("a.preview").mousemove(function(e){
		$("#preview")
			.css("top",(e.pageY - xOffset) + "px")
			.css("left",(e.pageX + yOffset) + "px");
	});			
};


function show_terms()
{
var myWindow;
    var width = 350;
    var height = 150;
    var left = parseInt((screen.availWidth/2) - (width/2));
    var top = parseInt((screen.availHeight/2) - (height/2));
	top=top-30;
    var windowFeatures = "menubar=no,status=no, width=" + width + ",height="+height+",resizable=yes,scrollbars=1,left=" + left + ",top=" + top + "screenX=" + left + ",screenY=" + top;
    myWindow = window.open('terms.php',"subWind", windowFeatures);
	
}
