var popupStatus = 0;
centerPopup30=function(){
	//request data for centering
	var windowWidth = document.documentElement.clientWidth;
	var windowHeight = document.documentElement.clientHeight;
	var popupHeight = $("#eventpassworddiv").height();
	var popupWidth = $("#eventpassworddiv").width();
	
	
  var scrOfX = 0, scrOfY = 0;
  if( typeof( window.pageYOffset ) == 'number' ) {
    //Netscape compliant
    scrOfY = window.pageYOffset;
    scrOfX = window.pageXOffset;
  } else if( document.body && ( document.body.scrollLeft || document.body.scrollTop ) ) {
    //DOM compliant
    scrOfY = document.body.scrollTop;
    scrOfX = document.body.scrollLeft;
  } else if( document.documentElement && ( document.documentElement.scrollLeft || document.documentElement.scrollTop ) ) {
    //IE6 standards compliant mode
    scrOfY = document.documentElement.scrollTop;
    scrOfX = document.documentElement.scrollLeft;
  }
  
 
	
	windowHeight1=windowHeight+scrOfY;
	
	windowHeight1=windowHeight1-100;
	poph=windowHeight1-popupHeight/2;
	poph=poph-150;
	
	
	
	//centering
	$("#eventpassworddiv").css({
		"position":"absolute",
		"top":poph,
		"left": windowWidth/2-popupWidth/2
		//"top":"150px",
		//"left":"200px"
		
	});
	//only need force for IE6
	
	$("#backgroundPopup").css({
		"height": windowHeight
	});
	
	
};

loadPopup30=function(eventname,eventid)
             {
			
			  if(popupStatus==0){
		$("#backgroundPopup").css({
			"opacity": "0.7"
		});
		$("#backgroundPopup").fadeIn("slow");
		
		popupStatus=1;
		
		$("#eventnameid").text(eventname);
		//$("#hevent_name").val()=eventname;
		document.getElementById("hevent_name").value=eventname;
		document.getElementById("hevent_id").value=eventid;
	
		$("#eventpassworddiv").fadeIn("slow");
		//$("#photoslideshow").fadeIn("slow");
		
	};
	
	
   
   
			 
			 
			 
			 };
 
 disablepopup30=function()
	          {
			  if(popupStatus==1){
			  
			    $("#backgroundPopup").fadeOut("slow");
				$("#eventpassworddiv").fadeOut("slow");
				popupStatus = 0;
			  
			  }
			  
			  
			  };
			  
			  disablepopup112=function()
	          {
			  if(popupStatus==1){
			  
			    $("#backgroundPopup").fadeOut("slow");
				$("#rotator").fadeOut("slow");
				popupStatus = 0;
			  
			  }
			  
			  
			  };
 emailme1=function(eventname,eventid)
        {
		
		centerPopup30();
		//load popup
	loadPopup30(eventname,eventid);
	   
	   $("#emailclose").click(function(event){
	  event.preventDefault();
	  disablepopup30();
	  
	  
	  
	  });
	  $("#emailclose1").click(function(event){
	  event.preventDefault();
	  disablepopup30();
	  
	  
	  
	  });
	   
	
};


centerPopup1=function(){
	//request data for centering
	var windowWidth = document.documentElement.clientWidth;
	var windowHeight = document.documentElement.clientHeight;
	//var popupHeight = $("#rotator").height();
	//var popupWidth = $("#rotator").width();
	
	//centering
	$("#rotator").css({
		"position": "absolute",
		//"top": windowHeight/2-popupHeight/2,
		//"left": windowWidth/2-popupWidth/2
		"top":"150px",
		"left":"250px"
		
	});
	//only need force for IE6
	
	$("#backgroundPopup").css({
		"height": windowHeight
	});
	if(popupStatus==0){
		$("#backgroundPopup").css({
			"opacity": "0.7"
		});
		$("#backgroundPopup").fadeIn("slow");
		
		
		//$("#photoslideshow").fadeIn("slow");
		
	}
	
};


var start=0;
var ex1;
loadPopup1=function(event_id){
   $.post("slideshow.php", {eventid:event_id,startim:start},
   function(data){
     
	 if(data=="yes")
	   {
	 
	   start=0;
	   ex1=0;

	   }
	   else
	   {
	 $("#rotator").html(data);
	 }
   });
   
	$("#rotator").fadeIn("slow");
	if(start==0 && ex1==0)
	   {
	   start=0;
	   }
	  
	 start=start+1;
	 
	
  t=window.setTimeout("loadPopup1('"+event_id+"')",3000);

	
	popupStatus = 1;
};

slideshowme=function(eventid)
      {
      centerPopup1();
		
	 loadPopup1(eventid);
	 };
	 
	 
	 
	 centerPopup112=function(){
	//request data for centering
	var windowWidth = document.documentElement.clientWidth;
	var windowHeight = document.documentElement.clientHeight;
	//var popupHeight = $("#rotator").height();
	//var popupWidth = $("#rotator").width();
	
	//centering
	$("#rotator").css({
		"position": "absolute",
		//"top": windowHeight/2-popupHeight/2,
		//"left": windowWidth/2-popupWidth/2
		"top":"150px",
		"left":"150px"
		
	});
	//only need force for IE6
	
	$("#backgroundPopup").css({
		"height": windowHeight
	});
	if(popupStatus==0){
		$("#backgroundPopup").css({
			"opacity": "0.7"
		});
		$("#backgroundPopup").fadeIn("slow");
		
		
		//$("#photoslideshow").fadeIn("slow");
		
	}
	
};
	 
	 loadPopup112=function(){
    if(popupStatus==0){
		$("#backgroundPopup").css({
			"opacity": "0.7"
		});
		$("#backgroundPopup").fadeIn("slow");
		
		popupStatus=1;
		
		
		
		$("#rotator").fadeIn("slow");
		//$("#photoslideshow").fadeIn("slow");
};
	 };
	 
	 slideshowme112=function()
      {
      centerPopup112();
		
	 loadPopup112();
	 $("#mygal112").click(function(event){
	  event.preventDefault();
	  disablepopup112();
	  
	  
	  
	  });
	 
	 };
	 
	 
	 savemefav=function(eventid,photoid,email,myid)
	   {
		
		
		var toid="fav"+photoid;
		 $.post("savefav.php", {event_id:eventid,photo_id:photoid,emailid:email},
         function(data){
                     if(data)
					    {
						
						
						html='<img src="Images/starx.png" style="border-width:0px;" />';
						html+='<span>remove favorite</span>';
				     	$('#'+myid).unbind("click", function(){});
					   $('#'+myid).bind("click", function(){removemefav(eventid,photoid,email,myid); });
					   $('#'+myid).html(html);
					    
					
					
							
						}
     
           });
		 
		 
		   
	   };
	   removemefav=function(eventid,photoid,email,myid)
	     {
			 
			 var toid="fav"+photoid;
		 $.post("delfav.php", {event_id:eventid,photo_id:photoid,emailid:email},
         function(data){
                     if(data)
					    {
						
						
						html='<img src="Images/symbol1x.png" style="border-width:0px;" />';
						html+='<span>save as favorite</span>';
					    $('#'+myid).unbind("click", function(){});
					   $('#'+myid).bind("click",function(){savemefav(eventid,photoid,email,myid); });
					   $('#'+myid).html(html);
					    
					
					
							
						}
     
           });
			 
		 };
		 centerPopup2=function(){
	//request data for centering
	var windowWidth = document.documentElement.clientWidth;
	var windowHeight = document.documentElement.clientHeight;
	//var popupHeight = $("#rotator").height();
	//var popupWidth = $("#rotator").width();
	
	//centering
	$("#newfolderdiv").css({
		"position": "absolute",
		//"top": windowHeight/2-popupHeight/2,
		//"left": windowWidth/2-popupWidth/2
		"top":"150px",
		"left":"400px"
		
	});
	//only need force for IE6
	
	$("#backgroundPopup").css({
		"height": windowHeight
	});
	
	
};

loadPopup2=function()
   {
   
   if(popupStatus==0){
		$("#backgroundPopup").css({
			"opacity": "0.7"
		});
		$("#backgroundPopup").fadeIn("slow");
		
		$("#newfolderdiv").fadeIn("slow");
		//$("#photoslideshow").fadeIn("slow");
		
	}
   
   popupStatus=1;
   
   };
   disablepopup2=function()
       {
	   if(popupStatus==1){
	   $("#newfolderdiv").fadeOut("slow");
	   $("#backgroundPopup").fadeOut("slow");
	   popupStatus = 0;
	   }
	   
	   };
	   
	   createnewfolder=function(eventid,emailid)
       {
		  
	   if($("#foldername").val()=="")
	     {
		  $("#foldererrmsg").text("plese enter foldername").css({ color:"red", fontWeight:"bolder" });
		   $("#foldererrrow").show("slow");
		  
		 return false;
		 }
		 else
		   {
			   
			   $.post("newfolderp.php", {event_id:eventid,email:emailid,foldername:$("#foldername").val()},
         function(data){
                     if(data)
					    {
					            if(data=="no")
								  {
									  $("#foldererrmsg").text("foldername already exists").css({ color:"red", fontWeight:"bolder" });
		                               $("#foldererrrow").show("slow");
									   return false;
								  }else
								    {
										$("#rightcategories").html(data);
										
										$("#foldererrrow").hide("slow");
										 if(popupStatus==1){
	                                         $("#newfolderdiv").fadeOut("slow");
	                                        $("#backgroundPopup").fadeOut("slow");
	                                           popupStatus = 0;
	                                           }
										
									}
					
					
					     }
     
           });
			   
			   
		   }
	   return true;
	   };
	   
	   
		 
		 newfolder=function()
		   {
			  centerPopup2();
		
	          loadPopup2();
	  
	    $("#newclose").click(function(event){
	    event.preventDefault();
	    disablepopup2();
	  
	  
	  
	   }); 
 };
 
 	centerPopup8=function(){
	//request data for centering
	var windowWidth = document.documentElement.clientWidth;
	var windowHeight = document.documentElement.clientHeight;
	var popupHeight = $("#adTofolderdiv").height();
	var popupWidth = $("#adTofolderdiv").width();
	
	
  var scrOfX = 0, scrOfY = 0;
  if( typeof( window.pageYOffset ) == 'number' ) {
    //Netscape compliant
    scrOfY = window.pageYOffset;
    scrOfX = window.pageXOffset;
  } else if( document.body && ( document.body.scrollLeft || document.body.scrollTop ) ) {
    //DOM compliant
    scrOfY = document.body.scrollTop;
    scrOfX = document.body.scrollLeft;
  } else if( document.documentElement && ( document.documentElement.scrollLeft || document.documentElement.scrollTop ) ) {
    //IE6 standards compliant mode
    scrOfY = document.documentElement.scrollTop;
    scrOfX = document.documentElement.scrollLeft;
  }
  
 
	
	windowHeight1=windowHeight+scrOfY;
	
	windowHeight1=windowHeight1-100;
	poph=windowHeight1-popupHeight/2;
	poph=poph-150;
	
	
	
	//centering
	$("#adTofolderdiv").css({
		"position":"absolute",
		"top":poph,
		"left": windowWidth/2-popupWidth/2
		//"top":"150px",
		//"left":"200px"
		
	});
	//only need force for IE6
	
	$("#backgroundPopup").css({
		"height": windowHeight
	});
	
	
};
loadPopup8=function(event_id,photo_id,email)
             {
			 
			 var event_id=event_id;
			 var photo_id=photo_id;
			  if(popupStatus==0){
		$("#backgroundPopup").css({
			"opacity": "0.7"
		});
		$("#backgroundPopup").fadeIn("slow");
		
		popupStatus=1;
		//alert($("#photoide").text());
		$("#adtofphotoid").text(photo_id).css({ color:"red", fontWeight:"bolder" });
		
		document.getElementById("adphotoid").value=photo_id;
		document.getElementById("adeventid").value=event_id;
		
		$("#adTofolderdiv").fadeIn("slow");
		//$("#photoslideshow").fadeIn("slow");
		
	}
   
   
			 
			 
			 
			 };		
			 
			 disablepopup8=function()
			    {
				
				 if(popupStatus==1){
			  
			    $("#backgroundPopup").fadeOut("slow");
				$("#adTofolderdiv").fadeOut("slow");
				popupStatus = 0;
			  
			  }
			  
				
				};
 addtofolder=function(eventid,email,photoid)
   {
	   
		centerPopup8();
		loadPopup8(eventid,photoid);
		 
		  $("#adfclose").click(function(event){
	  event.preventDefault();
	  disablepopup8();
	  
	  
	  
	  });
	   
   };
   checkFolder=function(eventid,email)
     {
		
		 mycount = 0;
		document.adTofolderform.action="adtofold.php";

		for(i=0;i<document.adTofolderform.elements.length;i++)
		{
			if(document.adTofolderform.elements[i].name=="fol_name[]" && document.adTofolderform.elements[i].checked)
			{
				mycount++;
				//myfoldes[i]=document.adTofolderform.elements[i].value;
				
			}
		}

		if(mycount==0)
		{
			 $("#addfoldererrmsg").text("You must select one of the folders.").css({ color:"red", fontWeight:"bolder" });
			//alert("You must check one of the checkboxes.");
			return false;
		}
		
		document.frm1.submit();
		
	 };
	 
	 centerPopup3=function(){
	//request data for centering
	var windowWidth = document.documentElement.clientWidth;
	var windowHeight = document.documentElement.clientHeight;
	var popupHeight = $("#emailphotodiv").height();
	var popupWidth = $("#emailphotodiv").width();
	
	
  var scrOfX = 0, scrOfY = 0;
  if( typeof( window.pageYOffset ) == 'number' ) {
    //Netscape compliant
    scrOfY = window.pageYOffset;
    scrOfX = window.pageXOffset;
  } else if( document.body && ( document.body.scrollLeft || document.body.scrollTop ) ) {
    //DOM compliant
    scrOfY = document.body.scrollTop;
    scrOfX = document.body.scrollLeft;
  } else if( document.documentElement && ( document.documentElement.scrollLeft || document.documentElement.scrollTop ) ) {
    //IE6 standards compliant mode
    scrOfY = document.documentElement.scrollTop;
    scrOfX = document.documentElement.scrollLeft;
  }
  
 
	
	windowHeight1=windowHeight+scrOfY;
	
	windowHeight1=windowHeight1-100;
	poph=windowHeight1-popupHeight/2;
	poph=poph-150;
	
	
	
	//centering
	$("#emailphotodiv").css({
		"position":"absolute",
		"top":poph,
		"left": windowWidth/2-popupWidth/2
		//"top":"150px",
		//"left":"200px"
		
	});
	//only need force for IE6
	
	$("#backgroundPopup").css({
		"height": windowHeight
	});
	
	
};
	 
	 loadPopup3=function(eventid,photoid)
             {
			 //alert("email");
			 var eventid=eventid;
			 var photoid=photoid;
			  if(popupStatus==0){
		$("#backgroundPopup").css({
			"opacity": "0.7"
		});
		$("#backgroundPopup").fadeIn("slow");
		
		popupStatus=1;
		//alert($("#photoide").text());
		$("#photoide").text(photoid).css({ color:"red", fontWeight:"bolder" });
		document.getElementById("eventemilid").value=eventid;
		document.getElementById("photoemailid").value=photoid;
		//$("#eventemilid").val()=photoid;
		
		$("#emailphotodiv").fadeIn("slow");
		//$("#photoslideshow").fadeIn("slow");
		
	}
   
   
			 
			 
			 
			 };
			 
			  disablepopup3=function()
	          {
			  if(popupStatus==1){
			  
			    $("#backgroundPopup").fadeOut("slow");
				$("#emailphotodiv").fadeOut("slow");
				popupStatus = 0;
			  
			  }
			  
			  
			  };
	 
	 
	 emailme=function(eventid,photoid)
        {
			
		var eventid=eventid;
		var photoid=photoid;
		centerPopup3();
		//load popup
	loadPopup3(eventid,photoid);
	   
	   $("#emailclose").click(function(event){
	  event.preventDefault();
	  disablepopup3();
	  
	  
	  
	  });
	  $("#emailclose1").click(function(event){
	  event.preventDefault();
	  disablepopup3();
	  
	  
	  
	  });
	   
	
		};
		
		
			 centerPopup10=function(){
	//request data for centering
	var windowWidth = document.documentElement.clientWidth;
	var windowHeight = document.documentElement.clientHeight;
	var popupHeight = $("#addtocartdiv").height();
	var popupWidth = $("#addtocartdiv").width();
	
	
  var scrOfX = 0, scrOfY = 0;
  if( typeof( window.pageYOffset ) == 'number' ) {
    //Netscape compliant
    scrOfY = window.pageYOffset;
    scrOfX = window.pageXOffset;
  } else if( document.body && ( document.body.scrollLeft || document.body.scrollTop ) ) {
    //DOM compliant
    scrOfY = document.body.scrollTop;
    scrOfX = document.body.scrollLeft;
  } else if( document.documentElement && ( document.documentElement.scrollLeft || document.documentElement.scrollTop ) ) {
    //IE6 standards compliant mode
    scrOfY = document.documentElement.scrollTop;
    scrOfX = document.documentElement.scrollLeft;
  }
  
 
	
	windowHeight1=windowHeight+scrOfY;
	
	windowHeight1=windowHeight1-100;
	poph=windowHeight1-popupHeight/2;
	poph=poph-150;
	
	
	
	//centering
	$("#addtocartdiv").css({
		"position":"absolute",
		"top":poph,
		"left": windowWidth/2-popupWidth/2
		//"top":"150px",
		//"left":"200px"
		
	});
	//only need force for IE6
	
	$("#backgroundPopup").css({
		"height": windowHeight
	});
	
	
};
		
			 loadPopup10=function(eventid,photoid)
             {
			 //alert("email");
			 var eventid=eventid;
			 var photoid=photoid;
			  if(popupStatus==0){
		$("#backgroundPopup").css({
			"opacity": "0.7"
		});
		$("#backgroundPopup").fadeIn("slow");
		
		popupStatus=1;
		//alert($("#photoide").text());
		$("#addphotocartphoto").text(photoid).css({ color:"red", fontWeight:"bolder" });
		//$("#hidenadd2cartphotoid").val()=photoid;
		document.getElementById("hidenadd2cartphotoid").value=photoid;
		//document.getElementById("mycartid").value=myid;
		//document.getElementById("photoemailid").value=photoid;
		
		
		$("#addtocartdiv").fadeIn("slow");
		
		
	}
   
   
			 
			 
			 
			 };
			 
			 disablepopup10=function()
	          {
			  if(popupStatus==1){
			  
			    $("#backgroundPopup").fadeOut("slow");
				$("#addtocartdiv").fadeOut("slow");
				popupStatus = 0;
			  
			  }
			  
			  
			  };
		
		addtocart=function(eventid,photoid)
		  {
			//alert(mycartid);
			
			centerPopup10();
		//load popup
	    loadPopup10(eventid,photoid);
	   
	   $("#addtocartclose").click(function(event){
	  event.preventDefault();
	  disablepopup10();
	  
	  
	  
	  });
		  };
		  
		  addtocartme=function(eventid)
		     {
				 
				 //myid=$("#mycartid").val();
				 photoid=$("#hidenadd2cartphotoid").val();
				 pricensize=$("#pricelist").val();
				 noofphotos=$("#quantity").val();
				 myid="addto"+photoid;
				 
				 $.post("addtocart.php", {event_id:eventid,photo_id:photoid,pricesize:pricensize,quantity:noofphotos},
         function(data){
                     if(data)
					    {
						$("#addtocartsucc").text(data).css({ color:"green", fontWeight:"bolder" });
					    $("#backgroundPopup").fadeOut(5000);
				      $("#addtocartdiv").fadeOut(5000);
				
				
				        html='<img src="Images/symbol7x.png" style="border-width:0px;" />';
						html+='<span>In Cart</span>';
				     	$('#'+myid).unbind("click", function(){});
					   $('#'+myid).bind("click", function(){removecart(eventid,photoid); });
					   $('#'+myid).html(html);
				
				        
						
						}
     
           });
				 
				 
			 };
			 
			 removecart=function(eventid,photoid)
			    {
					//alert("remove me from cart");
					myid="addto"+photoid;
					
					$.post("removecart.php", {event_id:eventid,photo_id:photoid},
         function(data){
                     if(data)
					    {
							
				
				        html='<img src="Images/add2cartx.png" style="border-width:0px;" />';
						html+='<span>ADD TO CART</span>';
				     	$('#'+myid).unbind("click", function(){});
					   $('#'+myid).bind("click", function(){addtocart(eventid,photoid); });
					   $('#'+myid).html(html);
				
				        
						
						}
     
           });
					
					
					
					
				};
			 
			 
			  centerPopup22=function(){
	//request data for centering
	var windowWidth = document.documentElement.clientWidth;
	var windowHeight = document.documentElement.clientHeight;
	//var popupHeight = $("#rotator").height();
	//var popupWidth = $("#rotator").width();
	
	//centering
	$("#editColors").css({
		"position": "absolute",
		//"top": windowHeight/2-popupHeight/2,
		//"left": windowWidth/2-popupWidth/2
		"top":"100px",
		"left":"100px"
		
	});
	//only need force for IE6
	
	$("#backgroundPopup").css({
		"height": windowHeight
	});
	
	
};

loadPopup22=function()
   {
   
   if(popupStatus==0){
		$("#backgroundPopup").css({
			"opacity": "0.7"
		});
		$("#backgroundPopup").fadeIn("slow");
		
		$("#editColors").fadeIn("slow");
		//$("#photoslideshow").fadeIn("slow");
		
		
		 
		
		
	}
   
   popupStatus=1;
   
   };
   
		disablepopup22=function()
	          {
			  if(popupStatus==1){
			  
			    $("#backgroundPopup").fadeOut("slow");
				$("#editColors").fadeOut("slow");
				popupStatus = 0;
			  
			  }
			  
			  
			  };	 
			 
			 
			   cropme=function(width,height,eventid,photoid)
			   {
    
	              
	jcrop_api=$.Jcrop('#cropbox',{
					setSelect:[0,0,width,height],
					onChange: updateCoords,
					onSelect: updateCoords
				});
					
	 
 centerPopup22();
		
	  loadPopup22();
	  $("#btnCancel").click(function(){
									
	  //disablepopup22();
	  document.location.href="single.php?event_id="+eventid+"&photo_id="+photoid;
	  
	  });
	  
	  
	  
	   $("#cropimgheader").click(function(e){
											   
										jcrop_api.enable();
									$("#cropimgdiv").show("slow");	
									$("#editimgborders").hide("slow");
									$("#editimgcolors").hide("slow");
									
											   
											   });
	     $("#editColorsheader").click(function(e){
											   
								    jcrop_api.disable();
									var thumbsrc=$("#thumbsrc").val();
									var x=$("#x").val();
									var y=$("#y").val();
									var w=$("#w").val();
									var h=$("#h").val();
									var width=$("#width").val();
									var height=$("#height").val();
									var event_id=$("#myeventid").val();
									var timeid=(new Date).getTime();
									$("#saddcart").show();
									$.post("singlecrop.php", {cropsrc:thumbsrc,x1:x,y1:y,w1:w,h1:h,width1:width,height1:height,eventid:event_id,tid:timeid},
            function(data){
                     if(data)
					    {
						
						          
								   //loadcropImage(data);
								   
								   
	       var tnew=(new Date).getTime();
			   //alert(tnew);
			   
			  var src1="getimagecrop.php?imagename="+data+"&t="+tnew;
			 //alert(src1);
			 //$("img#cropbox").attr("src",src1);
			 var html='<img  src="'+src1+'"  id="cropbox" />';
			// alert($("img#cropbox").attr("src"));
			 $("#editphotoid").html(html);
			 
						           $("#cropimgdiv").hide("slow");	
									$("#editimgborders").hide("slow");
									$("#editimgcolors").show("slow");
					
							
						}
     
           });
									
									
									
											   
											   });
		 
		  $("#addbordersheader").click(function(e){
											   
										jcrop_api.disable();
									$("#cropimgdiv").hide("slow");	
									$("#editimgcolors").hide("slow");	
									$("#editimgborders").show("slow");	
									
									
											   
											   });
	  
			   };
			   
			   
			   
			   
			   
			   
			updateCoords=function(c)
			  {
				  
				  $('#x').val(c.x);
				$('#y').val(c.y);
				$('#w').val(c.w);
				$('#h').val(c.h);
				  
			  };
			    checkCoords=function()
			{
				alert("hi");
				if (parseInt($('#w').val())) return true;
				alert('Please select a crop region then press submit.');
				return false;
			};





//books art page function 
 changePhoto=function(idof)
	   {
	  // alert(idof);
	   if(idof=="t1")
	     {
		//alert("t1");
	   document.getElementById("fullimage").src="Images/designed-layout-img.jpg";
		 
		 }else if(idof=="t2")
		   {
		  document.getElementById("fullimage").src="Images/artbook-p1.jpg";
		   }else if(idof=="t3")
		    {
			document.getElementById("fullimage").src="Images/artbook-p2.jpg";
			
			}else if(idof=="t4")
			{
			document.getElementById("fullimage").src="Images/artbook-p3.jpg";
			}
			else
			{
			
			}
	 
	   };
	   OriginalImage=function()
	      {
		  document.getElementById("fullimage").src="Images/artbook-p4.png"
		  };


//books art page function end

//books page edit folders popup
loadPopup12=function()
             {
			 //alert("email");
			
			  if(popupStatus==0){
		$("#backgroundPopup").css({
			"opacity": "0.7"
		});
		$("#backgroundPopup").fadeIn("slow");
		
		popupStatus=1;
		
		$("#createfolderdiv").fadeIn("slow");
		//$("#photoslideshow").fadeIn("slow");
		
	}
   
 };


 centerPopup12=function(){
	//request data for centering
	var windowWidth = document.documentElement.clientWidth;
	var windowHeight = document.documentElement.clientHeight;
	var popupHeight = $("#createfolderdiv").height();
	var popupWidth = $("#createfolderdiv").width();
	
	
  var scrOfX = 0, scrOfY = 0;
  if( typeof( window.pageYOffset ) == 'number' ) {
    //Netscape compliant
    scrOfY = window.pageYOffset;
    scrOfX = window.pageXOffset;
  } else if( document.body && ( document.body.scrollLeft || document.body.scrollTop ) ) {
    //DOM compliant
    scrOfY = document.body.scrollTop;
    scrOfX = document.body.scrollLeft;
  } else if( document.documentElement && ( document.documentElement.scrollLeft || document.documentElement.scrollTop ) ) {
    //IE6 standards compliant mode
    scrOfY = document.documentElement.scrollTop;
    scrOfX = document.documentElement.scrollLeft;
  }
  
 
	
	windowHeight1=windowHeight+scrOfY;
	
	windowHeight1=windowHeight1-100;
	poph=windowHeight1-popupHeight/2;
	poph=poph-150;
	
	
	
	//centering
	$("#createfolderdiv").css({
		"position":"absolute",
		"top":poph,
		"left": windowWidth/2-popupWidth/2
		//"top":"150px",
		//"left":"200px"
		
	});
	//only need force for IE6
	
	$("#backgroundPopup").css({
		"height": windowHeight
	});
	
	
};






disablepopup12=function()
	          {
			  if(popupStatus==1){
			  
			    $("#backgroundPopup").fadeOut("slow");
				$("#createfolderdiv").fadeOut("slow");
				popupStatus = 0;
			  
			  }
			  
			  
			  };


editfolders=function()
     {
	 
	//alert("hi");  
	 centerPopup12(); 
	 loadPopup12();
	  $("#createfolderdiv").click(function(event){
	  event.preventDefault();
	  disablepopup12();
	    
	  });
	 
	 };
//books page edit folders popup end //

//books page learnmore//

loadPopup13=function()
             {
			 //alert("email");
			
			  if(popupStatus==0){
		$("#backgroundPopup").css({
			"opacity": "0.7"
		});
		$("#backgroundPopup").fadeIn("slow");
		
		popupStatus=1;
		
		$("#booklearnmorediv").fadeIn("slow");
		//$("#photoslideshow").fadeIn("slow");
		
	}
   
 };


 centerPopup13=function(){
	//request data for centering
	var windowWidth = document.documentElement.clientWidth;
	var windowHeight = document.documentElement.clientHeight;
	var popupHeight = $("#booklearnmorediv").height();
	var popupWidth = $("#booklearnmorediv").width();
	
	
  var scrOfX = 0, scrOfY = 0;
  if( typeof( window.pageYOffset ) == 'number' ) {
    //Netscape compliant
    scrOfY = window.pageYOffset;
    scrOfX = window.pageXOffset;
  } else if( document.body && ( document.body.scrollLeft || document.body.scrollTop ) ) {
    //DOM compliant
    scrOfY = document.body.scrollTop;
    scrOfX = document.body.scrollLeft;
  } else if( document.documentElement && ( document.documentElement.scrollLeft || document.documentElement.scrollTop ) ) {
    //IE6 standards compliant mode
    scrOfY = document.documentElement.scrollTop;
    scrOfX = document.documentElement.scrollLeft;
  }
  
 
	
	windowHeight1=windowHeight+scrOfY;
	
	windowHeight1=windowHeight1-100;
	poph=windowHeight1-popupHeight/2;
	poph=poph-150;
	
	
	
	//centering
	$("#booklearnmorediv").css({
		"position":"absolute",
		"top":poph,
		"left": windowWidth/2-popupWidth/2
		//"top":"150px",
		//"left":"200px"
		
	});
	//only need force for IE6
	
	$("#backgroundPopup").css({
		"height": windowHeight
	});
	
	
};






disablepopup13=function()
	          {
			  if(popupStatus==1){
			  
			    $("#backgroundPopup").fadeOut("slow");
				$("#booklearnmorediv").fadeOut("slow");
				popupStatus = 0;
			  
			  }
			  
			  
			  };


bookslearnmore=function()
     {
	 
	//alert("hi");  
	 centerPopup13(); 
	 loadPopup13();
	  $("#booklearnmorediv").click(function(event){
	  event.preventDefault();
	  disablepopup13();
	    
	  });
	 
	 };

//books page learnmore end//

//memory book images//
 changePhoto1=function(idof)
	   {
	  // alert(idof);
	   if(idof=="t1")
	     {
		//alert("t1");
	   document.getElementById("fullimage").src="Images/memory_bigimage1.png";
		 
		 }else if(idof=="t2")
		   {
		  document.getElementById("fullimage").src="Images/memory_bigimage2.png";
		   }else if(idof=="t3")
		    {
			document.getElementById("fullimage").src="Images/memory_bigimage3.png";
			
			}else if(idof=="t4")
			{
			document.getElementById("fullimage").src="Images/memory_bigimage4.png";
			}
			else
			{
			
			}
	 
	   };
	   OriginalImage1=function()
	      {
		  document.getElementById("fullimage").src="Images/memory_bigimage.png"
		  };
//memory book images end//

getMycolorimg=function(ppath,mycolor)
   {      
   
   
        $("#mylastcolor").val(mycolor);
       var event_id=$("#myeventid").val();
	   	   var timeid=(new Date).getTime();
	   $.post("singlecolor.php", {imgpath:ppath,imgcolor:mycolor,eventid:event_id,tid:timeid},
            function(data){
                     if(data)
					    {
						
						          
								   //loadcropImage(data);
								   
								   
	       var tnew=(new Date).getTime();
			   //alert(tnew);
			   
			  var src1="getimagecolor.php?imagename="+data+"&t="+tnew;
			 
			 var html='<img src="'+src1+'"  id="cropbox" />';
			// alert($("img#cropbox").attr("src"));
			 $("#editphotoid").html(html);
			 
						           
					
							
						}
     
           });
									
	   
   };
   
   getmyborderimg=function(ppath,borderst)
     {
		//alert(ppath);
		//alert(borderst);
		$("#mylastborder").val(borderst);
		var event_id=$("#myeventid").val();
	   	   var timeid=(new Date).getTime();
		   $.post("singleborder.php", {imgpath:ppath,imgborder:borderst,eventid:event_id,tid:timeid},
            function(data){
                     if(data)
					    {
						
						          
			 var tnew=(new Date).getTime();
			   
			   
			  var src1="getimageborder.php?imagename="+data+"&t="+tnew;
			
			 var html='<img src="'+src1+'"  id="cropbox" />';
			// alert($("img#cropbox").attr("src"));
			 $("#editphotoid").html(html);
			 
						           
					
							
						}
     
           });
		   
		   
	 };
	 
	 savenaddtocart=function(eventid,photopath,photoid)
	   {
		   var mylastcolor=$("#mylastcolor").val();
		   var mylastborder=$("#mylastborder").val();
		   
		   //alert(mylastcolor);
		   //alert(mylastborder);
		   $.post("savenadd2cart.php", {imgpath:photopath,event_id:eventid,mycolor:mylastcolor,myborder:mylastborder,photo_id:photoid},
            function(data){
                     if(data)
					    {
						
						          
			            alert("your modified photo has been saved and added to the  cart");
						        
					
							document.location.href="single.php?event_id="+eventid+"&photo_id="+photoid;
						}
     
           });
		   
	   }
     
