// JavaScript Document
function createCookie(name,value,days) {
	if (days && value!="3039") {
		
		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!="" && value!="3039")
	{
		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/recurringLicenseOrder.do?id="+id;
				 url = "https://www3.masterwriter.com/store/store/recurringLicenseOrder.do?id="+id;
			}
			else{
				//url = "https://localhost/store/store/recurringLicenseOrder.do";
				url = "https://www3.masterwriter.com/store/store/recurringLicenseOrder.do";
			}
			window.location = url;
		}
		else if(document.form1.year.checked == true){
			
			if(id!=null && id!=""){
				 //url1 = "https://localhost/store/store/licenseOrder.do?id="+id;
				 url1 = "https://www3.masterwriter.com/store/store/licenseOrder.do?id="+id;
			}
			else{
				//url1 = "https://localhost/store/store/licenseOrder.do";
				url1 = "https://www3.masterwriter.com/store/store/licenseOrder.do";
			}
			window.location = url1;
		}
		else if(document.form1.purchase.checked == true){
			
			if(id!=null && id!=""){
				 //url2 = "https://localhost/store/store/newOrder.do?id="+id;
				 url2 = "https://www3.masterwriter.com/store/store/newOrder.do?id="+id;
			}
			else{
				//url2 = "https://localhost/store/store/newOrder.do";
				url2 = "https://www3.masterwriter.com/store/store/newOrder.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];
}

function getYearDivId(id){
	
	if(id==null ||id=="")
	{
		
		id=readCookie('id');
		
	}
	if(id=='3039')
		return "id1021yearschoollicense";
	else
		return "id1021-yearlicense";
}

function getUnlimitedDivId(id){
	
	if(id==null ||id=="")
	{
		
		id=readCookie('id');
		
	}
	if(id=='3039')
	return "id103schoolpurchase";
	else
		return "id103purchase ";
}
