function GetCookie(CookieName){var cname=CookieName+"=";var i=0;while(i<document.cookie.length){var j=i+cname.length;if(document.cookie.substring(i,j)==cname){var leng=document.cookie.indexOf(";",j);if(leng==-1)leng=document.cookie.length;return unescape(document.cookie.substring(j,leng));}
i=document.cookie.indexOf(" ",i)+1;if(i==0)break;}
return"*";}
function parseCookie(cookieValue,citem){var indx=0,citemlen=0;if(cookieValue==null)return"*"
if(cookieValue=="*")return"*"
for(var i=0;i<citem;i++){indx=(citem==0)?0:cookieValue.indexOf("!",indx+1)+1;}
citemlen=(cookieValue.indexOf("!",indx)>0)?cookieValue.indexOf("!",indx+1):cookieValue.length;if(cookieValue.substring(indx,citemlen)==null){return"*";}
else
return cookieValue.substring(indx,citemlen);}
function getStoredMatrixName(){cookieValue=GetCookie("DecompLabelsCookie");if(cookieValue!="*")
return parseCookie(cookieValue,1);else
return"";}
function getStoredDecompType(){cookieValue=GetCookie("DecompLabelsCookie");if(cookieValue!="*")
return parseCookie(cookieValue,2);else
return"process";}
function getStoredIdPrefix(){cookieValue=GetCookie("DecompLabelsCookie");if(cookieValue!="*")
return parseInt(parseCookie(cookieValue,3));else
return'*';}
function getStoredInputs(){cookieValue=GetCookie("DecompLabelsCookie");if(cookieValue!="*")
return parseInt(parseCookie(cookieValue,4));else
return 0;}
function getStoredOutputs(){cookieValue=GetCookie("DecompLabelsCookie");if(cookieValue!="*")
return parseInt(parseCookie(cookieValue,5));else
return 0;}
function getStoredMatrix(){cookieValue=GetCookie("DecompMatrixCookie");if(cookieValue!="*")
return parseCookie(cookieValue,3);else
return"";}
function getCurrentUsage(){cookieValue=GetCookie("DecompUsageCookie");if(cookieValue!="*")
return parseInt(parseCookie(cookieValue,1));else
return 0;}
function cookiesTurnedOn(){var TheCookieName="DecompTestCookie";var WholeCookie=" ";var cookieValue;var numDays=448;var expire=new Date();expire.setTime(expire.getTime()+(numDays*24*3600000));document.cookie=TheCookieName+"="+escape(WholeCookie)+"; expires="+expire.toGMTString();cookieValue=GetCookie(TheCookieName);if(cookieValue=="*"){return false;}
else{expire.setTime(expire.getTime()-1);document.cookie=TheCookieName+"="+escape(WholeCookie)+"; expires="+expire.toGMTString();return true;}}
function putMatrixCookie(formInputs,formOutputs,formMatrix){var CookieName="DecompMatrixCookie";var WholeCookie="";var numDays=448;var expire=new Date();expire.setTime(expire.getTime()+(numDays*24*3600000));version=1;WholeCookie=version+"!"+formInputs+"!"+formOutputs+"!"+formMatrix;document.cookie=CookieName+"="+escape(WholeCookie)+"; expires="+expire.toGMTString()+"; path=/";}
function putUsageCookie(newUsage){var CookieName="DecompUsageCookie";var WholeCookie="";numDays=448;var expire=new Date();expire.setTime(expire.getTime()+(numDays*24*3600000));version=1;WholeCookie=version+"!"+newUsage;document.cookie=CookieName+"="+escape(WholeCookie)+"; expires="+expire.toGMTString()+"; path=/";}
