﻿// JScript File
self.focus();

function settingsToggle(which){
   if (document.getElementById(which).style.display == 'none'){
        document.getElementById(which).style.display='block';
   }
   else document.getElementById(which).style.display='none';
}

function hideWhat(hideThis){
    document.getElementById(hideThis).style.display='none';
}

function showWhat(showThis){
    document.getElementById(showThis).style.display='block';
}

function gotothanks(whichThanks){
    if ((whichThanks != "") && (whichThanks != null) && (whichThanks != 'undefined')){
    //alert('should not be in here');
    hideWhat(whichThanks);
    }
    else {hideWhat('uniqueContent');}
    
    //hideWhat('validation');
    //hideWhat('required');
    showWhat('Thanks');
    self.location.href="#topOfPage";
    return false;
}


function changeTitle(newTitle){
    document.getElementById('title').innerHTML = newTitle;
}

function forgotPassword(){
    showWhat('getPassword');hideWhat('login');hideWhat('notRegistered');hideWhat('forgotPassword');changeTitle('Forgot Password?');
}

function goWhere(here){
    document.location.href=here;
}

function OpenWin(url,windowName, width, height, top) {
agent = navigator.userAgent;
params  = "";
params += "toolbar=0,";
params += "location=0,";
params += "directories=0,";
params += "status=0,";
params += "menubar=0,";
params += "scrollbars=1,";
params += "resizable=0,";
params += "width="+width+",";
params += "height="+height+",";
win = window.open(url, windowName , params);
win.focus();
}

function OpenNewWin(url,windowName) {
OpenWin(url,windowName, 515, 250, 250);
}

function getCrumb(){
    document.getElementById('crumb').innerHTML = document.getElementById('title').innerHTML;
}

var today = new Date()
var year = today.getYear()

function insertYear(whichID){
    if(year<1000) year+=1900
    {
        document.getElementById(whichID).innerHTML = year
        //alert(year);
        //document.write(year)
    }
}

function checkThis(){
    if(document.location.href.search('promo') != -1)
    {
       showWhat('promoForm');
       hideWhat('loginForm');
       hideWhat('personalButtons');
    }
    }








/******* THIS IS ALL SCRIPT FOR CHECKBOX CHANGER**********/
//global variables that can be used by ALL the function son this page. 
var inputs; 
var imgFalse = '/images/formImages/false_green.gif'; 
var imgTrue = '/images/formImages/true_green.gif'; 

//this function runs when the page is loaded, put all your other onload stuff in here too. 
function init() { 
    replaceChecks(); 
} 

function replaceChecks() { 
     
    //get all the input fields on the page 
    inputs = document.getElementsByTagName('input'); 

    //cycle trough the input fields 
    for(var i=0; i < inputs.length; i++) { 

        //check if the input is a checkbox 
        if(inputs[i].getAttribute('type') == 'checkbox') { 
             
            //create a new image 
            var img = document.createElement('img'); 
             
            //check if the checkbox is checked 
            if(inputs[i].checked) { 
                img.src = imgTrue; 
            } else { 
                img.src = imgFalse; 
            } 

            //set image ID and onclick action 
            img.id = 'checkImage'+i; 
            //set image 
            img.onclick = new Function('checkChange('+i+')'); 
            //place image in front of the checkbox 
            inputs[i].parentNode.insertBefore(img, inputs[i]); 
             
            //hide the checkbox 
            inputs[i].style.display='none'; 
        } 
    } 
} 

//change the checkbox status and the replacement image 
function checkChange(i) { 

    if(inputs[i].checked) { 
        inputs[i].checked = ''; 
        document.getElementById('checkImage'+i).src=imgFalse; 
    } else { 
        inputs[i].checked = 'checked'; 
        document.getElementById('checkImage'+i).src=imgTrue; 
    } 
} 

window.onload = init;

/* CHECKBOX CHANGER SCRIPT ENDS HERE */
function CloseWindow()
{
    self.close();
    self.opener.DisplayFile(); 
}
function DisplayFile()
{
		    
//window.location.reload(true);
window.document.forms(0).submit();
			
}
