var highlightImages=new Array();
function sethighlight(OverImgSrc,pageImageName)
{
    if (!document.images)return;
    highlightImages[pageImageName]=new Object;
    highlightImages[pageImageName].overImg = new Image;
    highlightImages[pageImageName].overImg.src=OverImgSrc;
}

function highlight(pageImageName)
{
    if (!document.images)return;
    if (!highlightImages[pageImageName])return;
    if (!highlightImages[pageImageName].outImg)
    {
        highlightImages[pageImageName].outImg = new Image;
        highlightImages[pageImageName].outImg.src = 
            document.images[pageImageName].src;
    }
    document.images[pageImageName].src=highlightImages[pageImageName].overImg.src;
}

function unhighlight(pageImageName)
{
    if (!document.images)return;
    if (!highlightImages[pageImageName])return;
    document.images[pageImageName].src=highlightImages[pageImageName].outImg.src;
}

function mailit( p5 )
{
    var p1 = "com"; var p2 = "."; var p3 = "sweetscape"; var p4 = "@";
    var p6 = ":"; var p7 = "to";  var p8 = "mail";
    window.location=p8+p7+p6+p5+p4+p3+p2+p1;
}

function RedirectClick( link )
{
    setTimeout('window.location.href = "' + link + '"', 2000);
}

function xencode( t )
{
    var c = t.length; 
    var s = "";
    var i=0; var v; var l;
    for( i = 0; i < c; i++ )
    {
        l = (t.charCodeAt(i) & 0xff) ^ ((173 * i + 93) & 0xff);
        v = (l >>> 4);
        s += String.fromCharCode( (v < 10) ? (48 + v) : (55 + v) );
        v = (l & 0xf);
        s += String.fromCharCode( (v < 10) ? (48 + v) : (55 + v) );
    }   
    return s;
}

function setValue()
{
    if( document.referrer && (document.referrer != "") && (document.referrer.indexOf("www.sweetscape.com") == -1) )
    {
        if( document.cookie.indexOf("rfid") == -1 )
        {
            var exp = new Date();
            var str = "";
            var tmp = document.referrer;
            if( location && (location.href.indexOf( "?google" ) != -1) )
                str = "G";
            if( exp.getMonth() + 1 < 10 )
                str += "0";
            str += exp.getMonth() + 1;
            if( exp.getDate() < 10 )
                str += "0";
            str += exp.getDate();
            if( exp.getYear() % 100 < 10 )
                str += "0";
            str += exp.getYear() % 100;
            if( tmp.indexOf( "http://" ) == 0 )
                tmp = tmp.substring( 7 );
            str += tmp;
            
            exp.setTime( exp.getTime() + (365 * 24 * 3600000) );
            document.cookie = "rfid=" + xencode(str) + "; expires=" + exp.toGMTString() + ";path=/;";
        }
    }
}

setValue();