function roundnumber(n, d)
{
    n = n - 0;
    if (d == null) d = 2;
    var f = Math.pow(10, d);
    n += Math.pow(10, - (d + 1));
    n = Math.round(n * f) / f;
    n += Math.pow(10, - (d + 1));
    n += '';
    return d == 0 ? n.substring(0, n.indexOf('.')) :  n.substring(0, n.indexOf('.') + d + 1);
}

function infowin(URL)
{
    day = new Date();
    id = day.getTime();
    eval("page" + id + " = window.open(URL, '" + id + "', 'toolbar=0,scrollbars=1,location=0,statusbar=0,menubar=0,resizable=1,width=800,height=660,left = 0,top = 0');");
}

function popUp(URL)
{
    day = new Date();
    id = day.getTime();
    eval("page" + id + " = window.open(URL, '" + id + "', 'toolbar=0,scrollbars=1,location=0,statusbar=0,menubar=0,resizable=1,width=800,height=660,left = 0,top = 0');");
}

function popWin(URL, width, height)
{
    day = new Date();
    id = day.getTime();
    eval("page" + id + " = window.open(URL, '" + id + "', 'toolbar=0,scrollbars=1,location=0,statusbar=0,menubar=0,resizable=1,width=" + width + ",height=" + height + ",left = 0,top = 0');");
}

function setCellColor(theCell, thePointerColor)
{
    if (thePointerColor == '' || typeof(theCell.style) == 'undefined') {
	   return false;
	}
    theCell.style.backgroundColor = thePointerColor;
    return true;
}

function verifyNewsletterSubscribe()
{
    return_flag = true;
    tag = document.getElementById('newsletter_email');
    if (isBlank(tag.value) || tag.value == 'email address') {
        alert("Please specify a valid email address!");
        tag.focus();
        return_flag = false;
    }
    if (((!isBlank(tag.value) && !checkemail(tag.value)) || tag.value == 'email address') && return_flag) {
        alert("Please specify a valid email address!");
        tag.focus();
        return_flag = false;
    }
    return return_flag;
}

function verifyNewsletterSubscribe2()
{
    return_flag = true;
    tag = document.getElementById('newsletter_email2');
    if (isBlank(tag.value) || tag.value == 'email address') {
        alert("Please specify a valid email address!");
        tag.focus();
        return_flag = false;
    }
    if (((!isBlank(tag.value) && !checkemail(tag.value)) || tag.value == 'email address') && return_flag) {
        alert("Please specify a valid email address!");
        tag.focus();
        return_flag = false;
    }
    return return_flag;
}

function verifyPostcardForm()
{
    var tag=document.getElementById('srcptname');
    if (isBlank(tag.value)) {
        alert('Please specify your friend name!'); tag.focus(); return false;
    }
    var tag=document.getElementById('ssendemail');
    if (isBlank(tag.value)) {
        alert('Please specify friend\'s e-mail address(es)!'); tag.focus(); return false;
    }
    var tag=document.getElementById('ssendername');
    if (isBlank(tag.value)) {
        alert('Please specify your name!'); tag.focus(); return false;
    }
    var tag=document.getElementById('ssenderemail');
    if (!checkemail(tag.value)) {
        alert(tag.value + ' is not a valid email address!'); tag.focus(); return false;
    }
    var tag=document.getElementById('smessage');
    if (isBlank(tag.value)) {
        alert('Please specify your message!'); tag.focus(); return false;
    }
    if (document.getElementById('secret_code_valid')) {

    } else {
        var tag = document.getElementById('secret_code');
    	if (isBlank(tag.value)) {
    	    alert("Please enter verification code."); tag.focus(); return false;
    	}
    }
    return true;
}

function display_news_comment(boxid)
{
    if(document.getElementById(boxid).style.display=='block') { document.getElementById(boxid).style.display = 'none'; }
    else { document.getElementById(boxid).style.display = 'block'; }
}
function verifyAddNewsCommentForm()
{
	var tag = document.getElementById('name');
	if (isBlank(tag.value)) { alert("Please specify a Your Name."); tag.focus(); return false; }
	var tag = document.getElementById('comment_text');
	if (isBlank(tag.value)) { alert("Please specify a Your Comment."); tag.focus(); return false; }
	var tag = document.getElementById('secret_code');
	if (isBlank(tag.value)) { alert("Please enter verification code."); tag.focus(); return false; }
	return true;
}

function random_banner() {
}