﻿function SetTheme(themeid) {
    if (testPersistentCookie())
    {
        writePersistentCookie('theme', themeid, 'days', 30);
        //writeSessionCookie('theme', themeid);
        location.reload(true);
    }
    else 
    {
        alert("You must enable session cookie to use the difrent themes");
    }
}

function wait(millis) {
    var date = new Date();
    var curDate = null;
    do { curDate = new Date(); }
    while (curDate - date < millis);
} 

function validateEmail(email) {  
    var re = /^(([^<>()[\]\\.,;:\s@\"]+(\.[^<>()[\]\\.,;:\s@\"]+)*)|(\".+\"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/;
    return re.test(email);
}

function isNumber(n) {
    return !isNaN(parseFloat(n)) && isFinite(n);
}


function stopEvent(e) {
    if (e != undefined) {
        if (e.stopPropagation) e.stopPropagation();
        else e.cancelBubble = true;

        if (e.preventDefault) e.preventDefault();
        else e.returnValue = false;
    }
}



