// ActionScript Document

function showonmap(cordinates){
	//alert('this feature is under development');
	window.location= "http://shahkotcity.com/maplocater.php?"+cordinates;
	}
function playvideo(url)
{
	
		$.fancybox({
			'padding'		: 0,
			'autoScale'		: false,
			'transitionIn'	: 'none',
			'transitionOut'	: 'none',
			'title'			: this.title,
			'width'		: 680,
			'height'		: 495,
			'href'			: url.replace(new RegExp("watch\\?v=", "i"), 'v/'),
			'type'			: 'swf',
			'swf'			: {
			   	 'wmode'		: 'transparent',
				'allowfullscreen'	: 'true'
			}
		});

	return false;	
}
$().ready(function(){
$('#slider').cycle({fx: 'all',speed: 1000,pause: 1,timeout: 8000,delay: 400});																																								$("#sliderl").cycle({fx: 'all',speed: 1000,pause: 1,timeout: 7000,delay: 290});
$("#slider2").cycle({fx: 'all',speed: 1000,pause: 1,timeout: 7000,delay: 290});

$("#mapimages").cycle({fx: 'fade',speed: 1000,pause: 0,timeout: 3000,delay: 290});

$("#pagination_ li:first").css({'color' : '#000000'}).css({'border' : 'solid #dddddd 1px'});
	  
		//Pagination_ Click
	 var allalphabets = Array('A','B','C','D','E','F','G','H','I','J','K','L','M','N','O','P','Q','R','S','T','U','V','W','X','Y','Z','ALL');	
		$("#pagination_ li").click(function(){
		
			//alert(this.id);
			//CSS Styles
			$("#pagination_ li").css({'border' : 'none'}).css({'color' : '#000000'});
			var founds=0;
			if(this.id!='ALL')
			{
				$('.alabhabet_'+this.id).each(function() {
										  founds++; 
										   });
			}else
			{
				founds = $("input#totalfidb").val();
			}
			$(".totalfound").html('Total '+"<br>"+founds+"<br>"+' Found');
			for(var co=0;co<allalphabets.length;co++)
			{
				if(this.id=='ALL')
				{
					$('.alabhabet_'+allalphabets[co]).css({display:'block'});
				}else if(this.id==allalphabets[co])
				{
					$('.alabhabet_'+allalphabets[co]).css({display:'block'});	
				}else
				{
					$('.alabhabet_'+allalphabets[co]).css({display:'none'});
				}
				$('.alabhabet_'+allalphabets[co]).css({'border' : 'none'}).css({'color' : '#000000'});
			}
			$(this)
		
			.css({'color' : '#000000'})
			.css({'border' : 'solid #dddddd 1px'});
			
			//Loading Data
			var pageNum = this.id;
		
		});
		
		
		//create image from all emails in the page
		function placeImage(data)
		{
			//alert(data.obj);
			$("#email_"+data.obj).html('<img src="../png/'+data.img+'.jpg" style="border:0px;" />');
			
		}
		var totalfoundimg = 0;
		$('.renderemail').each(function() {
			var gettxt = $(this).html();	
			//alert(gettxt);
			$(this).html('<span id="email_'+totalfoundimg+'"></span>');
			$(this).css({"display":"block"});
			$.getJSON('../include/renderimage.php', {'msg' : gettxt,'obj':totalfoundimg}, placeImage);	
			totalfoundimg++;
		});
		
		
		//create gallery 
		function placeGallery(data)
		{
			//alert(data.obj);
			//$(".mkgallery").html(data.result);
			$("#gallery_"+data.gid).html(data.result);
			$("a.fancy_cl").fancybox({
				'overlayShow'	: false,
				'transitionIn'	: 'elastic',
				'transitionOut'	: 'elastic'
			});
		}
		var totalfoundG= 0;
		$('.mkgallery').each(function() {
			var path = $(this).attr("id");
			$(this).html('<span id="gallery_'+totalfoundG+'">Getting data...</span>');
			$.getJSON('../include/makegallery.php', {'path' : path,'gid':totalfoundG}, placeGallery);	
			totalfoundG++;
		});
		
});		
