// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ //

function openWindow(url,width,height,settings) {

	startDate= new Date();
	
    if (settings == 0) {
		tb = loc = rs = sts = scr = mn = "no"; 
	}
    else if (settings == 2) {
		tb = loc = rs = sts = scr = mn = "yes";
	}
    else { 
		tb = loc = "no"; 
		rs = sts = scr = mn = "yes"; 
	} 

    newWindow = window.open(url,startDate.getTime(),'toolbar='+tb+',location='+loc+',resizable='+rs+',status='+sts+',scrollbars='+scr+',menubar='+mn+',width='+width+',height='+height);
}

// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ //

function decodeCookie(cookie) {

	var item = new Object();
	var currentCookies = cookie.split("||");

	for (var i=0; i < currentCookies.length ; i++ ) {
		if (currentCookies[i].indexOf('::') > -1) {
			keyValuePair = currentCookies[i].split("::");
	        item[keyValuePair[0]] = keyValuePair[1];
		}
	}
	return item;
}

function getCookie(name) {

    var cookieName = name + "=";

    var i = 0;
    while (i < document.cookie.length) {
        var j = i + cookieName.length;
        if (document.cookie.substring(i, j) == cookieName) {
            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 delCookie(cookieName) {
  document.cookie = cookieName + "=; expires= Thu, 01-Jan-70 00:00:01 GMT";
  document.cookie = cookieName + "=; expires= Thu, 01-Jan-70 00:00:01 GMT; path=/";
  return true;
}

function setCookie(name, contents) {
  document.cookie = name + "= " + escape(contents) + "; expires=Mon, 01-Jan-2010 00:00:01 GMT; path=/";
  return true;
}

// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ //
