

function getCookie(c_name)
{
var i,x,y,ARRcookies=document.cookie.split(";");
for (i=0;i<ARRcookies.length;i++)
{
  x=ARRcookies[i].substr(0,ARRcookies[i].indexOf("="));
  y=ARRcookies[i].substr(ARRcookies[i].indexOf("=")+1);
  x=x.replace(/^\s+|\s+$/g,"");
  if (x==c_name)
    {
    return unescape(y);
    }
  }
}




$(function() {
		// a workaround for a flaw in the demo system (http://dev.jqueryui.com/ticket/4375), ignore!
		$( "#dialog:ui-dialog" ).dialog( "destroy" );
		$( "#dialog-form" ).dialog({
			autoOpen: false,
			height:360,
			width:745,
			resizable: false, 
			modal: true
		});
		
		
		$( "#subscribe-user" )
			.button()
			.click(function() {
				$( "#dialog-form" ).dialog( "open" );
			});
			
		
		if(getCookie("pummernewsletter") != "subscribed_visitor"){
			//alert("you are not subscribed");
			$("#wish_list").live("click", function(){
				$( "#dialog-form" ).dialog( "open" );
				alert("Sorry you have to be subscribed to our newsletter in order to add products to your wish list!");
			})
			} 
		
		
		/*	
		$( "#submit" )
			.button()
				$("#dialog-form").dialog("destroy");
				$( "#confirmation" ).dialog( "open" );
				$.cookie("subscribed", "yes", { expires: 1 });
			});
			*/	
  			
	});
