cookiedomain = ".rent-at-avis.com"; CookieLIVEDAYSDefault=30; var CookieLIVEDAYS=0; function cookie_live() { var date=new Date(); var xTTL=0; //try to read TTL form cookie at first xTTL = parseInt( getCookieValue( 'CTTL' ) ); if( !isNaN(xTTL)) { CookieLIVEDAYS = xTTL; } if( CookieLIVEDAYS == 0) { CookieLIVEDAYS = CookieLIVEDAYSDefault; } date.setDate(date.getDate() + CookieLIVEDAYS); var gmt=date.toGMTString(); var k1=gmt.indexOf(" "); var k2=gmt.indexOf(" ", k1+1); var k3=gmt.indexOf(" ", k2+1); var str=gmt.substring(0,k2)+"-"+gmt.substring(k2+1,k3)+"-"+gmt.substring(k3+3,gmt.length); return str; } function clearCookie() { var expiryDate; expiryDate = 'Wednesday, 07-Jan-04 23:59:59 GMT ' document.cookie= 'expires=' + expiryDate + ';domain=' + cookiedomain + ';path=/'; } function getCookieValue( xParam ) { xRet = ""; if(document.cookie) { values = document.cookie.split( xParam + '='); if( values[1] ) { tid = values[1].split(';'); xRet = tid[0]; } } return xRet; } function setCookieValue( xParam ) { var expires = new Date(); var expiryDate; var xParamString; xParamString = xParam + ';expires='+ cookie_live() + ';domain=' + cookiedomain + ';path=/'; document.cookie= xParamString; } /* function for smart quick booking */ function replaceAll( source, matchlist, replacevalues ) { xMatchList = matchlist.split(','); xReplaceValues = replacevalues.split('%'); for( i=0; i< xMatchList.length; i++ ) { xMatch = new RegExp( xMatchList[i] ); source = source.replace( xMatch, xReplaceValues[i] ); } return source; }