

function openpop(url, w, h, t, L, s) {
    if (s == "Yes") {
        window.open(url, "", "width=" + w + ",height=" + h + ",top=" + t + ",left=" + L + ",scrollbars=yes");
    }
    else {
        window.open(url, "", "width=" + w + ",height=" + h + ",top=" + t + ",left=" + L + "");
    }
}

function openPopup(url, w, h, t, L) {
        window.open(url, "", "width=" + w + ",height=" + h + ",top=" + t + ",left=" + L + "");
}


function NowPlaying_Load() {

    var rand;
    rand = Math.random();
    ajax("NowPlayingText", "/playlist/nowplaying2010.aspx?rand=" + rand);

}

function NowPlaying_Start() {

    NowPlaying_Load();
    setTimeout("NowPlaying_Start()", 10000);

}

function ajax(id, src) {


    if (window.XMLHttpRequest) {
        // code for IE7+, Firefox, Chrome, Opera, Safari
        xmlhttp = new XMLHttpRequest();
    }
    else {
        // code for IE6, IE5
        xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
    }

    xmlhttp.onreadystatechange = function () {
        if (xmlhttp.readyState == 4 && xmlhttp.status == 200) {
            document.getElementById(id).innerHTML = xmlhttp.responseText;
        }
    }
    xmlhttp.open("GET", src, true);
    xmlhttp.send();


}


function mail(domain,user) { 
    document.location.href = "mailto:" + user + "@" + domain;
}

function MailForm2(t, s, b) {
    // t is the addresses to be sent to. They will have a dash where the @ symbol should be and they will be replaced in the emailform.asp page.
    // s is for the subject and is optional
    // b is for the message body and is optional

    window.open("/mailform/redirect.asp?to=" + t + "&subject=" + s + "&body=" + b + "", "", "width=600,height=380,top=150,left=200");

}

function Contestmail(domain,user,subject) 
{
    var strTo = "mailto:" + user + "@" + domain;
    document.location.href = strTo + "?subject=" + subject + "&body=Please provide: Name, Address, City, State, Zip, and Phone";
}

function newsletter(domain,user) 
{ 
    document.location.href = "mailto:" + user + "@" + domain + "?subject=Send me a newsletter&body=Please send us your Name, Address, City, State and Zip code information (We are not able to send the newsletter out of the U.S.)";
}

function Contestmail(domain,user, subject) 
{
    var strTo = "mailto:" + user + "@" + domain;
    document.location.href = strTo + "?subject=" + subject + "&body=Please provide: Name, Address, City, State, Zip, and Phone";
}

function startblend(x) {
    if (x == 1) {
        blendimage('blenddiv','blendimage', '/images/PraiseChristmasHeader2011b.jpg', 400);
        x++;
    }
    else if (x == 2) {
        blendimage('blenddiv','blendimage', '/images/PraiseChristmasHeader2011a.jpg', 400);
        x--;
    }

    if (x == 0) {
        x = 1;
    }
    
    var t=setTimeout("startblend(" + x + ")", 10000);
}

function blendimage(divid, imageid, imagefile, millisec) { 
    var speed = Math.round(millisec / 100); 
    var timer = 0; 
     
    //set the current image as background 
    document.getElementById(divid).style.backgroundImage = "url(" + document.getElementById(imageid).src + ")"; 
     
    //make image transparent 
    changeOpac(0, imageid); 
     
    //make new image 
    document.getElementById(imageid).src = imagefile; 

    //fade in image 
    for(i = 0; i <= 100; i++) { 
        setTimeout("changeOpac(" + i + ",'" + imageid + "')",(timer * speed)); 
        timer++; 
    } 
} 

//change the opacity for different browsers 
function changeOpac(opacity, id) { 
    var object = document.getElementById(id).style; 
    object.opacity = (opacity / 100); 
    object.MozOpacity = (opacity / 100); 
    object.KhtmlOpacity = (opacity / 100); 
    object.filter = "alpha(opacity=" + opacity + ")"; 
} 

