﻿  	var showC=0;
	var readmoreS=0;
	var Show=0;
	
	var isiPad = navigator.userAgent.match(/iPad/i) != null;
	var isiPhone = navigator.userAgent.match(/iPhone/i) !=null;
	$(document).ready(function() {
	
	//Side sample sites button animation
	 	
	      
          $("#test").delay(2000).animate({"marginLeft": "0px"}, 2000,
							  function () { 
							  		  
	   
							  
							  
							  $("#sample_sites").css({"z-index":1999});
							//  $("#pluspop").css({"display":"block"});
							$("#txt_hide").css({"display":"block"});
							  if(isiPhone || isiPad ){ 
							  $("#txt_hide").css({"display":"none", "height":"auto"});	
							  $(".showhide").click(function(){
									   
						showSlidingDiv();			   
									   
									   });
							   }
							
							
							else{
								  
							     $("#txt_hide").animate({"height":"100px"},800);
							      samplesiteanim();
							  }
							
							  }
		 );
	
		   $("#imageCnames").click(function(){
				showCredits();					 
									 });
		   
		   
		   
		   
	
			$("#pluspop").mouseover(function(){
				showpopup();		 
						 
			
		   });


	
	      $(".Artists_pop_link, #pluspop, #test, #servicePD").click(function(){
		      //centering with css
		        popupPlace();
		      //load popup
		       showpopup();
	       });
	 		
	      //CLOSING POPUP
	      //Click the x event!
        $("#popupArtistsClose").click(function(){
		    hidepopup();
	     });
	    //Click out event!
	  
	  
	   $("#outofPopUp").click(function(){
	    								   
									
		hidepopup();
		
	   });
       
	   
	   

	   
 
		   
$(document).keypress(function(e){
		if(e.keyCode==27 && Show==1){
			hidepopup();
		}
		
	
	});
		    
 })
 
function samplesiteanim() {

		 
		 
		   $("#txt_hide").delay(800).animate({"height":"0px"}, {duration: 2000, easing:'easeOutBounce', complete: function() {
															$("#txt_hide").css({"display":"none", "height":"auto"});		
															  $(".showhide").click(function(){
									   
						showSlidingDiv();			   
									   
									   });
															
																	}
								 });

	
	
}
 function showSlidingDiv(){	
	
	
        $("#txt_hide").slideToggle()("slow");
				
		
 }



/*credits popup*/
function showCredits(){
	
	if(showC==0){
				$("#imageCnames").css({"display":"block"});
				showC=1;
	}
	
	else if(showC==1){
		$("#imageCnames").css({"display":"none"});
				showC=0;
		
	     }
	  }


/*sample sites popup*/
function showpopup() {

	if(Show==0){
		$("#outofPopUp").css({
			 "display": "block",
			"opacity": "0",
			"filter": "Alpha(Opacity=0)"
		});
		$("#popupArtists").css({
								"display": "block"
		});
		
		Show = 1;
	}
	 showhover(); 
}

/*Mouser over effect for popup artists*/
function showhover() { 
				$(".lar").mouseover(function() {
									$(this).css("background","#CCC");	 
										 
										 
										 }).mouseout(function() {
											 
											$(this).css("background","#FFF"); 
											 
											 
										 });	
										 
	}  
	

function gotoArtistSite(url){
	

window.open(url,"_blank");

return false;	
	
}



 
function hidepopup() {
	//disables popup only if it is enabled
	if(Show==1){
	
		$("#outofPopUp").css({
		"display": "none"
		});

		$("#popupArtists").css({"display": "none", "position":"absolute","top":"auto", "left": "auto", "margin-left":"-270px", "margin-top":"50px","width":"260px"});
		$(".grayBG").css({"width":"260px","height":"150px"});
		
		Show = 0;
	}
}	




	
//centering popup
function popupPlace(){
	//request data for centering
	var windowWidth = document.documentElement.clientWidth;
	var windowHeight = document.documentElement.clientHeight;
	var popupHeight = $("#popupArtists").height();
	var popupWidth = $("#popupArtists").width();
	//centering
	$("#popupArtists").css({
		"position": "fixed",
		"top": windowHeight/2-popupHeight/2-120,
		"left": windowWidth/2-popupWidth/2-160,
		"margin-left":"0px",
		"margin-top":"0px",
		 "width":"540px"
	});
	$(".grayBG").css({
					 "width":"540px",
					 "height":"380px"
					 
					 });
	//only need force for IE6
	
	$("#outofPopUp").css({
		"height": windowHeight
	});
	
	
}
