$(document).ready(function() {	

	//select all the a tag with name equal to modal
	$('a[name=modal]').mouseover(function(e) {
		//Cancel the link behavior
		e.preventDefault();
		
		//Get the A tag
		var id = $(this).attr('href');
	
		//Get the screen height and width
		var maskHeight = $(document).height();
		var maskWidth = $(window).width();
	
		//Set heigth and width to mask to fill up the whole screen
		$('#mask').css({'width':maskWidth,'height':maskHeight});
		
		//transition effect		
		$('#mask').fadeIn(1000);	
		$('#mask').fadeTo("slow",50);	
	
		//Get the window height and width
		var winH = $(window).height();
		var winW = $(window).width();
              
		//Set the popup window to center
		$(id).css('top',  winH/2-$(id).height()/2);
		$(id).css('left', winW/2-$(id).width()/2);
	
		//transition effect
		$(id).fadeIn(1000); 
	
	});
	
	
	
	

	//if close button is clicked
	$('.window .close').click(function (e) {
		//Cancel the link behavior
		e.preventDefault();
		
		$('#mask').hide();
		$('.window').hide();
	});		
	
	//if mask is clicked
	$('#mask').click(function () {
		$(this).hide();
		$('.window').hide();
	});			
	
	
});

function commentProduct()
{
		$('a[name=modal9]').click(function(e) {
		//Cancel the link behavior
		e.preventDefault();
		
		//Get the A tag
		var id = $(this).attr('href');
	
		//Get the screen height and width
		var maskHeight = $(document).height();
		var maskWidth = $(window).width();
	
		//Set heigth and width to mask to fill up the whole screen
		$('#mask').css({'width':maskWidth,'height':maskHeight});
		
		//transition effect		
		$('#mask').fadeIn(1000);	
		$('#mask').fadeTo("slow",50);	
	
		//Get the window height and width
		var winH = $(window).height();
		var winW = $(window).width();
              
		//Set the popup window to center
		$(id).css('top',  winH/2-$(id).height()/2);
		$(id).css('left', winW/2-$(id).width()/2);
	
		//transition effect
		$(id).fadeIn(1000); 
	
	});

	//if close button is clicked
	$('.window .close').click(function (e) {
		//Cancel the link behavior
		e.preventDefault();
		
		$('#mask').hide();
		$('.window').hide();
	});		
	
	//if mask is clicked
	$('#mask').click(function () {
		$(this).hide();
		$('.window').hide();
	});			
	
}
function ratingProduct()
{
		$('a[name=modal2]').click(function(e) {
		//Cancel the link behavior
		e.preventDefault();
		
		//Get the A tag
		var id = $(this).attr('href');
	
		//Get the screen height and width
		var maskHeight = $(document).height();
		var maskWidth = $(window).width();
	
		//Set heigth and width to mask to fill up the whole screen
		$('#mask').css({'width':maskWidth,'height':maskHeight});
		
		//transition effect		
		$('#mask').fadeIn(1000);	
		$('#mask').fadeTo("slow",50);	
	
		//Get the window height and width
		var winH = $(window).height();
		var winW = $(window).width();
              
		//Set the popup window to center
		$(id).css('top',  winH/2-$(id).height()/2);
		$(id).css('left', winW/2-$(id).width()/2);
	
		//transition effect
		$(id).fadeIn(1000); 
	
	});

	//if close button is clicked
	$('.window .close').click(function (e) {
		//Cancel the link behavior
		e.preventDefault();
		
		$('#mask').hide();
		$('.window').hide();
	});		
	
	//if mask is clicked
	$('#mask').click(function () {
		$(this).hide();
		$('.window').hide();
	});			
	
}

/**************************Verifying1*****************************/
function verifying1(){	
    cookieEvents("", "", "","", "verify");
    $.ajax({
        url:"verify.php",
        type:"GET",
        success:function(msg){
            if(msg == "0"){
				alert("Please login to rate this product.");
            }else if(msg == "1"){
                $.post("postrating.php",
				{
		  			"productid":$("#productid").val(),
		  			"productrate1":$("#productrate1").val() 
				},
				function(msg)
				{
	 			if(msg == "1")
				{
 			 		alert("Thank you");
					$("#dialog2").css("display","none");
				}
				},
				"json"
				);
            }
        }
    });
}
/**************************End Verifying1*****************************/
/**************************Verifying2*****************************/
function verifying2(){	
    cookieEvents("", "", "","", "verify");
    $.ajax({
        url:"verify.php",
        type:"GET",
        success:function(msg){
            if(msg == "0"){
				alert("Please login to rate this product.");
            }else if(msg == "1"){
                $.post("postrating2.php",
				{
		  			"productid":$("#productid").val(),
		  			"productrate2":$("#productrate2").val() 
				},
				function(msg)
				{
	 			if(msg == "1")
				{
 			 		alert("Thank you");
					$("#dialog2").css("display","none");
				}
				},
				"json"
				);
            }
        }
    });
}
/**************************End Verifying2*****************************/
/**************************Verifying3*****************************/
function verifying3(){	
    cookieEvents("", "", "","", "verify");
    $.ajax({
        url:"verify.php",
        type:"GET",
        success:function(msg){
            if(msg == "0"){
				alert("Please login to rate this product.");
            }else if(msg == "1"){
                $.post("postrating3.php",
				{
		  			"productid":$("#productid").val(),
		  			"productrate3":$("#productrate3").val() 
				},
				function(msg)
				{
	 			if(msg == "1")
				{
 			 		alert("Thank you");
					$("#dialog2").css("display","none");
				}
				},
				"json"
				);
            }
        }
    });
}
/**************************End Verifying3*****************************/

/**************************Verifying4*****************************/
function verifying4(){	
    cookieEvents("", "", "","", "verify");
    $.ajax({
        url:"verify.php",
        type:"GET",
        success:function(msg){
            if(msg == "0"){
				alert("Please login to rate this product.");
            }else if(msg == "1"){
                $.post("postrating4.php",
				{
		  			"productid":$("#productid").val(),
		  			"productrate4":$("#productrate4").val() 
				},
				function(msg)
				{
	 			if(msg == "1")
				{
 			 		alert("Thank you");
					$("#dialog2").css("display","none");
				}
				},
				"json"
				);
            }
        }
    });
}
/**************************End Verifying4*****************************/

/**************************Verifying5*****************************/
function verifying5(){	
    cookieEvents("", "", "","", "verify");
    $.ajax({
        url:"verify.php",
        type:"GET",
        success:function(msg){
            if(msg == "0"){
				alert("Please login to rate this product.");
            }else if(msg == "1"){
                $.post("postrating5.php",
				{
		  			"productid":$("#productid").val(),
		  			"productrate5":$("#productrate5").val() 
				},
				function(msg)
				{
	 			if(msg == "1")
				{
 			 		alert("Thank you");
					$("#dialog2").css("display","none");
				}
				},
				"json"
				);
            }
        }
    });
}
/**************************End Verifying5*****************************/

/*function rating1(){
	
	$.post("postrating.php",
	{
		  "productid":$("#productid").val(),
		  "productrate1":$("#productrate1").val() 
	},
	function(msg)
	{
	 if(msg == "1")
		{
 			 alert("Thanku For your Rating.");
		}
	},
	"json"
	);
}

function rating2(){
	$.post("postrating2.php",
	{
		  "productid":$("#productid").val(),
		  "productrate2":$("#productrate2").val() 
	},
	function(msg)
	{
	 if(msg == "1")
		{
 			 alert("Thanku For your Rating.");
		}
	},
	"json"
	);
}

function rating3(){
	$.post("postrating3.php",
	{
		  "productid":$("#productid").val(),
		  "productrate3":$("#productrate3").val() 
	},
	function(msg)
	{
	 if(msg == "1")
		{
 			 alert("Thanku For your Rating.");
		}
	},
	"json"
	);
}

function rating4(){
	$.post("postrating4.php",
	{
		  "productid":$("#productid").val(),
		  "productrate4":$("#productrate4").val() 
	},
	function(msg)
	{
	 if(msg == "1")
		{
 			 alert("Thanku For your Rating.");
		}
	},
	"json"
	);
}

function rating5(){
	$.post("postrating5.php",
	{
		  "productid":$("#productid").val(),
		  "productrate5":$("#productrate5").val() 
	},
	function(msg)
	{
	 if(msg == "1")
		{
 			 alert("Thanku For your Rating.");
		}
	},
	"json"
	);
}

*/
function productComment_Rating()
{

		$('a[name=modal3]').click(function(e) {

		//Cancel the link behavior
		e.preventDefault();
		
		//Get the A tag
		var id = $(this).attr('href');
	
		//Get the screen height and width
		var maskHeight = $(document).height();
		var maskWidth = $(window).width();
	
		//Set heigth and width to mask to fill up the whole screen
		$('#mask').css({'width':maskWidth,'height':maskHeight});
		
		//transition effect		
		$('#mask').fadeIn(1000);	
		$('#mask').fadeTo("slow",50);	
	
		//Get the window height and width
		var winH = $(window).height();
		var winW = $(window).width();
              
		//Set the popup window to center
		$(id).css('top',  winH/2-$(id).height()/2);
		$(id).css('left', winW/2-$(id).width()/2);
	
		//transition effect
		$(id).fadeIn(1000); 
	
	});

	//if close button is clicked
	$('.window .close').click(function (e) {
		//Cancel the link behavior
		e.preventDefault();
		
		$('#mask').hide();
		$('.window').hide();
	});		
	
	//if mask is clicked
	$('#mask').click(function () {
		$(this).hide();
		$('.window').hide();
	});			
	
}





