<!--
var expires = new Date();
expires.setTime(expires.getTime()+30*60*60*24*100);
//deleteCookie("basket");

function addtocart(sn) {
    var content=getCookie("basket");
    //alert("basket is : " + content + " : " + sn + " : " +  content.indexOf(sn));
    if ( content.indexOf(sn) > 0 ) {
	alert("Item already in your basket");
    } else {
	alert("Adding item to your basket");
	   setCookie("basket", content + ":" + sn, expires);
    }
}

function setCookie(name, value, expire) {
	var expire;
    document.cookie= name + "=" + value + ";path=/;expires=" + expire.toGMTString();
}

function getCookie(name) {
    var cookieFound=false;
    var emprtCookie=false;
    var start=0;
    var end=0;
    var cookieString = document.cookie;
    var i=0;
    //alert("Cookie string is " + cookieString);

    // look for an empty cookie first if
    // found then return an empty string.
    //
    while(i <= cookieString.length) {
	start=i;
	end = start + name.length + 1;
	if ( cookieString.substring(start,end) == name + ";" ) {
	    emptyCookie=true;
	    return "";
	}
	i++;
    }

    // look for name in COOKIE string
    //
    i=0;
    while(i <= cookieString.length) {
	start=i;
	end = start + name.length;
	if ( cookieString.substring(start,end) == name ) {
	    cookieFound=true;
	    break;
	}
	i++;
    }

    // Check if name was found
    //
    if (cookieFound) {
	start=end+1;
	end = cookieString.indexOf(";", start);
	if ( end < start) {
	    end = cookieString.length;
	}
	return unescape(cookieString.substring(start,end));
    }

    // Here id name was not found
    //
    return "";
}


function deleteCookie(name) {
    var expires = new Date();
    expires.setTime(expires.getTime() - 1 );
    setCookie(name, "Delete Cookie", expires);
}


/*
 * convert to two digits and currency format
 */
function conDec(tmp)
{
    var alertbox=false;
    var tmp;
    tmp = tmp*100;
    tmp = Math.round(tmp);
    if(isNaN(tmp)) {tmp = 0.00;}
    if(tmp>99999999999)alert("trillion is not supported - only millions.");
    /* converts tmp to decimal cents and adds a 0 to .1 to .9 or adds .00 to 0 */
    cen = tmp%100;
    if(cen < 0){cen = ".00"}
    else if(cen <10) {cen = ".0"+cen}
    else if(cen < 100){cen = "."+cen}
    else {cen = cen}
    if(alertbox)alert("Cents "+cen);  /* Cents alert dialog box */

    tmp = parseInt(tmp/100);
    hun = tmp - ((parseInt(tmp/1000)) *1000 );
    if(hun > 0 && hun <1000) {hun = hun}
    else {hun = ''}
    if(alertbox)alert("Hundreds "+hun); /* Hundreds alert dialog box */

    tmp = parseInt(tmp/1000)
    tho = tmp -((parseInt(tmp/1000)) *1000);
    if(tho > 0 && tho < 1000) {tho = tho +","}
    else {tho = ''}
    if(alertbox)alert("Thousands "+tho);  /* Thousands dialog box */


    tmp = parseInt(tmp/1000);
    mil = tmp -((parseInt(tmp/1000)) *1000);
    if(mil > 0 && mil < 1000) {mil = mil + ","}
    else {mil = ''}
    if(alertbox)alert("Millions "+mil); /* Millions dialog box */
    if(alertbox)alert("$"+mil+tho+hun+cen); /* Convert tmp to Currency */

    return ""+mil+tho+hun+cen;
}


//-->

