
function GWACookieManager()
{this.SEPARATOR_ITENS="|";this.TIMEOUT_SECONDS="86400";this.setSeparatorItens=function(separator)
{this.SEPARATOR_ITENS=separator;}
this.getSeparatorItens=function()
{return this.SEPARATOR_ITENS;}
this.setTimeoutSeconds=function(seconds)
{this.TIMEOUT_SECONDS=seconds;}
this.addCookie=function(nameCookie,value)
{if(typeof(this.TIMEOUT_SECONDS)!='undefined')
{var date=new Date();date.setTime(date.getTime()+(this.TIMEOUT_SECONDS*1000));var expires="; expires="+date.toGMTString();}
else
{var expires="";}
var stringCookie=this.readCookie(nameCookie);if(stringCookie==null||stringCookie=="")
document.cookie=nameCookie+"="+value+expires+"; path=/";else
{if(!this.existInCookie(nameCookie,value))
document.cookie=nameCookie+"="+stringCookie+this.getSeparatorItens()+value+expires+"; path=/";}}
this.readCookie=function(nameCookie)
{nameCookie=nameCookie+"=";var carray=document.cookie.split(';');for(var i=0;i<carray.length;i++)
{var c=carray[i];while(c.charAt(0)==' ')c=c.substring(1,c.length);if(c.indexOf(nameCookie)==0)return c.substring(nameCookie.length,c.length);}
return null;}
this.deleteCookie=function(nameCookie)
{var date=new Date();date.setTime(date.getTime()+-1);var expires="; expires="+date.toGMTString();document.cookie=nameCookie+"=;"+expires+";path=/";}
this.removeItemCookie=function(nameCookie,itemReference,position_itemReference,separator_values)
{this.updateItemCookie(nameCookie,itemReference,position_itemReference,separator_values,null);}
this.existInCookie=function(nameCookie,value)
{var stringCookie=this.readCookie(nameCookie);if(stringCookie!=null&&stringCookie.indexOf(value)!=-1)
return true;else
return false;}
this.isSupported=function()
{return navigator.cookieEnabled;}
this.updateItemCookie=function(nameCookie,itemReference,position_itemReference,separator_values,newValue)
{var stringCookie=this.readCookie(nameCookie);var newStringCookie="";if(stringCookie!=null&&stringCookie!="")
{var values=stringCookie.split(this.getSeparatorItens());for(var x=0;x<values.length;x++)
{var item=values[x];if(separator_values!=null)
{var value=item.split(separator_values);for(var tx=0;tx<value.length;tx++)
{if(tx==position_itemReference&&value[tx]==itemReference)
{item=newValue;break;}}}
else
{if(item==itemReference)
item=newValue;}
if(item!=null)
newStringCookie+=this.getSeparatorItens()+item;}
this.deleteCookie(nameCookie);if(newStringCookie.substring(0,1)==this.getSeparatorItens())
newStringCookie=newStringCookie.substring(1);if(newStringCookie!=null&&newStringCookie!=""){this.addCookie(nameCookie,newStringCookie);}}}
this.gettValueItemCookie=function(nameCookie,idReferenceIten)
{alert("Resource not implemented!");}}
gwaCookieManager=new GWACookieManager();
