function Get_Cookie( check_name ) {
var a_all_cookies = document.cookie.split( ';' );
var a_temp_cookie = '';
var cookie_name = '';
var cookie_value = '';
var b_cookie_found = false;
var i = '';
for ( i = 0; i < a_all_cookies.length; i++ )
{
a_temp_cookie = a_all_cookies[i].split( '=' );
cookie_name = a_temp_cookie[0].replace(/^\s+|\s+$/g, '');
if ( cookie_name == check_name )
{
b_cookie_found = true;
if ( a_temp_cookie.length > 1 )
{
cookie_value = unescape( a_temp_cookie[1].replace(/^\s+|\s+$/g, '') );
}
return cookie_value;
break;
}
a_temp_cookie = null;
cookie_name = '';
}
if ( !b_cookie_found )
{
return null;
}
return null;
}
function Set_Cookie( name, value, expires, path, domain, secure ) {
var today = new Date();
today.setTime( today.getTime() );
if ( expires )
{
expires = expires * 1000 * 60 * 60 * 24;
}
var expires_date = new Date( today.getTime() + (expires) );
var strCookie = name + "=" +escape( value ) +
( ( expires ) ? ";expires=" + expires_date.toGMTString() : "" ) + //expires.toGMTString()
( ( path ) ? ";path=" + path : "" ) +
( ( domain ) ? ";domain=" + domain : "" ) +
( ( secure ) ? ";secure" : "" );
//alert(strCookie);
document.cookie=strCookie;
}
function Delete_Cookie( name, path, domain ) {
if ( Get_Cookie( name ) ) document.cookie = name + "=" +
( ( path ) ? ";path=" + path : "") +
( ( domain ) ? ";domain=" + domain : "" ) +
";expires=Thu, 01-Jan-1970 00:00:01 GMT";
}
function URL_encode(string) {
if(string==null)return"";
return escape(UTF8_encode(string));
};
function URL_decode(string) {
if(string==null)return"";
return UTF8_decode(unescape(string));
}
var _keyStr = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789._-";
function Base64_encode (input) {
var output = "";
var chr1, chr2, chr3, enc1, enc2, enc3, enc4;
var i = 0;
if(input==null)return"";
input = UTF8_encode(input);
while (i < input.length) {
chr1 = input.charCodeAt(i++);
chr2 = input.charCodeAt(i++);
chr3 = input.charCodeAt(i++);
enc1 = chr1 >> 2;
enc2 = ((chr1 & 3) << 4) | (chr2 >> 4);
enc3 = ((chr2 & 15) << 2) | (chr3 >> 6);
enc4 = chr3 & 63;
if (isNaN(chr2)) {
enc3 = enc4 = 64;
} else if (isNaN(chr3)) {
enc4 = 64;
}
output = output +
_keyStr.charAt(enc1) + _keyStr.charAt(enc2) +
_keyStr.charAt(enc3) + _keyStr.charAt(enc4);
}
return output;
}
// public method for decoding
function Base64_decode (input) {
var output = "";
var chr1, chr2, chr3;
var enc1, enc2, enc3, enc4;
var i = 0;
if(input==null)return"";
input=String(input);
input = input.replace(/[^A-Za-z0-9\+\/\=]/g, "");
while (i < input.length) {
enc1 = _keyStr.indexOf(input.charAt(i++));
enc2 = _keyStr.indexOf(input.charAt(i++));
enc3 = _keyStr.indexOf(input.charAt(i++));
enc4 = _keyStr.indexOf(input.charAt(i++));
chr1 = (enc1 << 2) | (enc2 >> 4);
chr2 = ((enc2 & 15) << 4) | (enc3 >> 2);
chr3 = ((enc3 & 3) << 6) | enc4;
output = output + String.fromCharCode(chr1);
if ((enc3 != 64)&&(chr2 != 0)) {
output = output + String.fromCharCode(chr2);
}
if ((enc4 != 64)&&(chr3 != 0)) {
output = output + String.fromCharCode(chr3);
}
}
output = UTF8_decode(output);
return output;
}
// private method for UTF-8 encoding
function UTF8_encode (str) {
//document.write('string='+string+'
');
if(str==null)return"";
str=String(str);
str = str.replace(/\r\n/g,"\n");
var utftext = "";
for (var n = 0; n < str.length; n++) {
var c = str.charCodeAt(n);
if (c < 128) {
utftext += String.fromCharCode(c);
}
else if((c > 127) && (c < 2048)) {
utftext += String.fromCharCode((c >> 6) | 192);
utftext += String.fromCharCode((c & 63) | 128);
}
else {
utftext += String.fromCharCode((c >> 12) | 224);
utftext += String.fromCharCode(((c >> 6) & 63) | 128);
utftext += String.fromCharCode((c & 63) | 128);
}
}
return utftext;
}
// private method for UTF-8 decoding
function UTF8_decode (utftext) {
var string = "";
var i = 0;
var c =0;
var c1 =0;
var c2 = 0;
var c3= 0;
if(utftext==null)return"";
while ( i < utftext.length ) {
c = utftext.charCodeAt(i);
if (c < 128) {
string += String.fromCharCode(c);
i++;
}
else if((c > 191) && (c < 224)) {
c2 = utftext.charCodeAt(i+1);
string += String.fromCharCode(((c & 31) << 6) | (c2 & 63));
i += 2;
}
else {
c2 = utftext.charCodeAt(i+1);
c3 = utftext.charCodeAt(i+2);
string += String.fromCharCode(((c & 15) << 12) | ((c2 & 63) << 6) | (c3 & 63));
i += 3;
}
}
return string;
}
var digitArray = new Array('0','1','2','3','4','5','6','7','8','9','a','b','c','d','e','f');
function toHex(n){
var result = ''
var start = true;
for (var i=32; i>0;){
i-=4;
var digit = (n>>i) & 0xf;
if (!start || digit != 0){
start = false;
result += digitArray[digit];
}
}
return (result==''?'0':result);
}
function pad(str, len, pad){
var result = str;
for (var i=str.length; i");
}
var page_recorded=false;
var i;
var tcc=18;
var tc;
var ntc;
var pc=-1;
var tca=new Array();
var _trackid;
function record_page()
{
if(page_recorded) return;
record_action('');
page_recorded=true;
}
function record_page_if(strPage,strAction)
{
if(page_recorded) return;
if(strPage==null) return;
var urlp=document.location.href;
var r=new RegExp(strPage,'ig');
if(urlp.match(r))
{
record_visit(strAction,tc);
page_recorded=true;
}
}
function record_action(action)
{
record_visit(action,tc);
}
function record_visit(action,tc)
{
load_url("http://store.coolwaremax.com/track/record.php","action="+action+"&tc="+tc+"&url="+URL_encode(window.location.href));
}
function TrackData_Unpack()
{
tc=Get_Cookie( '_wcmtc' );
tc=Base64_decode(tc);
if(tc!=null)
{
tca=tc.split("&");
}
for(i=0;i