function setCookie(cookieName,cookieValue,nDays) {
 var today = new Date();
 var expire = new Date();
 if (nDays==null || nDays==0) nDays=1;
 expire.setTime(today.getTime() + 3600000*24*nDays);
 document.cookie = cookieName+"="+escape(cookieValue)
                 + ";expires="+expire.toGMTString();
}

/**
 * Gets the value of the specified cookie.
 *
 * name  Name of the desired cookie.
 *
 * Returns a string containing value of specified cookie,
 *   or null if cookie does not exist.
 */
function getCookie(name) {
    var dc = document.cookie;
    var prefix = name + "=";
    var begin = dc.indexOf("; " + prefix);
    if (begin == -1) {
        begin = dc.indexOf(prefix);
        if (begin != 0) return null;
    } else {
        begin += 2;
    }
    var end = document.cookie.indexOf(";", begin);
    if (end == -1) {
        end = dc.length;
    }
    return unescape(dc.substring(begin + prefix.length, end));
}

/**
 * Deletes the specified cookie.
 *
 * name      name of the cookie
 * [path]    path of the cookie (must be same as path used to create cookie)
 * [domain]  domain of the cookie (must be same as domain used to create cookie)
 */
function deleteCookie(name, path, domain) {
    if (getCookie(name)) {
        document.cookie = name + "=" +
            ((path) ? "; path=" + path : "") +
            ((domain) ? "; domain=" + domain : "") +
            "; expires=Thu, 01-Jan-70 00:00:01 GMT";
    }
}
/**
 * replace characters.
 *
 * inChar    name of the character to replace ex &
 * outChar  what to replace it with ex and
 */
function replaceCharacters(conversionString,inChar,outChar)
{
  var convertedString = conversionString.split(inChar);
  convertedString = convertedString.join(outChar);
  return convertedString;
}
// open contents of a div in a new window without formating for printing
function PrintView( $div )
{
	var PrintContent=$($div).innerHTML;
	myWin=window.open('','myWin');
	myWin.document.write(PrintContent);
	myWin.document.close()
}
// open contents of a div in a new window without formating for printing and
// tries to print the document
function PrintViewAndPrint( $div, $pre, $post)
{
	if($pre == null){$pre='';}
	if($post == null){$post='';}
	var PrintContent=$($div).innerHTML;
	myWin=window.open('','myWin');
	myWin.document.write($pre + PrintContent + $post);
	myWin.print();
	myWin.document.close()
}
function PrintViewAndPrintTest( $div, $pre, $post)
{
	if($pre == null){$pre='';}
	if($post == null){$post='';}
	var PrintContent=$($div).innerHTML;
	myWin=window.open('http://www.nclworldwide.com/testfiles/will/route_guide_maps.php?routingcust=formwood&numrgcarriers=3','myWin');
	myWin.document.write($pre);
	myWin.document.write(eval($($div).innerHTML));
	myWin.document.write($post);
	//myWin.print();
	myWin.document.close()
}