function getCookie(c_name){
if (document.cookie.length>0)
  {
  c_start=document.cookie.indexOf(c_name + "=");
  if (c_start!=-1)
	{
	c_start=c_start + c_name.length+1;
	c_end=document.cookie.indexOf(";",c_start);
	if (c_end==-1) c_end=document.cookie.length;
	return unescape(document.cookie.substring(c_start,c_end));
	}
  }
return "";
}

function setCookie(c_name,value,expiredays){
var exdate=new Date();
exdate.setDate(exdate.getDate()+expiredays);
document.cookie=c_name+ "=" +escape(value)+
((expiredays==null) ? "" : ";expires="+exdate.toGMTString());
}


$(document).ready(function(){


		$('#ShopMainLayOutTable .SubmitButton_Orderstep1').click(function() {

			CNName = $('#ShopMainLayOutTable .CustomerData_Orderstep1_TBL #name').val();
			CNadress = $('#ShopMainLayOutTable .CustomerData_Orderstep1_TBL #email').val();
			
//			if ($('#ShopMainLayOutTable .CustomerData_Orderstep1_TBL input[name==\'useMailList\']').val() == 'ON' && CNadress.length >= 1){
			if ($('#ShopMainLayOutTable .CustomerData_Orderstep1_TBL table:first input:checked').eq(0).val() == 'ON' && CNadress.length >= 1){
				setCookie('Ubivox-Name',CNName,365);
				setCookie('Ubivox-Mail',CNadress,365);
//				alert(getCookie('Ubivox'))
			}else{
				setCookie('Ubivox-Name','',-1);
				setCookie('Ubivox-Mail','',-1);
//				alert(getCookie('Ubivox'))
			}
	
		});


	if	(location.href.indexOf('/order3.html') != -1){
		
		if (getCookie('Ubivox-Mail') != ''){
		
//			$.get('/FromGetToPost.asp?Ubivox-Mail='+ getCookie('Ubivox-Mail'));
			//$.get('/FromGetToPost.asp?Ubivox-Mail='+ getCookie('Ubivox-Mail') +'&Ubivox-Name='+ getCookie('Ubivox-Name'));
		
		}

	}

});