// JavaScript Document
function createCookie(name,value,days) {
	if (days) {
		var date = new Date();
		date.setTime(date.getTime()+(days*24*60*60*1000));
		var expires = "; expires="+date.toGMTString();
	}
	else var expires = "";
	if(value!=null && value!="")
	{
		document.cookie = name+"="+value+expires+"; path=/";
	}
}

function readCookie(name) {
	var nameEQ = name + "=";
	var ca = document.cookie.split(';');
	for(var i=0;i < ca.length;i++) {
		var c = ca[i];
		while (c.charAt(0)==' ') c = c.substring(1,c.length);
		if (c.indexOf(nameEQ) == 0) return c.substring(nameEQ.length,c.length);
	}
	return null;
}
function licenseType(id){
	
	if(id==null ||id=="")
	{
		
		id=readCookie('id');
		
		
	}
		if(document.form1.permonth.checked == true){
			if(id!=null && id!=""){
				 //url = "https://localhost/store/store/recurringLicenseCWOrder.do?id="+id;
				 url = "https://www3.masterwriter.com/store/store/recurringLicenseCWOrder.do?id="+id;
			}
			else{
				//url = "https://localhost/store/store/recurringLicenseCWOrder.do";
				url= "https://www3.masterwriter.com/store/store/recurringLicenseCWOrder.do";
			}
			window.location = url;
		}
		else if(document.form1.year.checked == true){
			
			if(id!=null && id!=""){
				 //url1 = "https://localhost/store/store/licenseCWOrder.do?id="+id;
				 url1 = "https://www3.masterwriter.com/store/store/licenseCWOrder.do?id="+id;
			}
			else{
				//url1 = "https://localhost/store/store/licenseCWOrder.do";
				url1= "https://www3.masterwriter.com/store/store/licenseCWOrder.do";
			}
			window.location = url1;
		}
		else if(document.form1.purchase.checked == true){
			
			if(id!=null && id!=""){
				 //url2 = "https://localhost/store/store/newCWOrder.do?id="+id;
				 url2 = "https://www3.masterwriter.com/store/store/newCWOrder.do?id="+id;
			}
			else{
				//url2 = "https://localhost/store/store/newCWOrder.do";
				url2 = "https://www3.masterwriter.com/store/store/newCWOrder.do";
			}
			window.location = url2;
		}
		else{
			alert("Please select one of the option");
		}
}
function gup( name )
{
  name = name.replace(/[\[]/,"\\\[").replace(/[\]]/,"\\\]");
  var regexS = "[\\?&]"+name+"=([^&#]*)";
  var regex = new RegExp( regexS );
  var results = regex.exec( window.location.href );
  if( results == null )
    return "";
  else
    return results[1];
}