// JScript File
// used to highlight the menu navigation bar at the top of the base pages
function mOvr(A_,B_)
{
	var browserName=navigator.appName; 
	if(browserName == "Microsoft Internet Explorer")
	{
		if(!A_.contains(event.fromElement))
			{A_.style.cursor='hand';A_.bgColor=B_;}
	}
	else
	{
		A_.style.cursor='hand';A_.bgColor=B_;
	}
}

// Used to remove highlight of the menu item at the top of the base pages
function mOut(A_,C_)
{
	var browserName=navigator.appName; 
	if(browserName == "Microsoft Internet Explorer")
	{
	if(!A_.contains(event.toElement))
		{A_.style.cursor='default';A_.bgColor=C_;}
	}
	else
	{
		A_.style.cursor='default';A_.bgColor=C_;
	}
}

// Used at the login in page to POST the user information to a SSL site
function submitLoginForm()
{
    // function to test for field validation
	var f;
	if (ValidatorOnSubmit() == false)
	{
	    if(document.getElementById('RequiredFieldValidator1').style.visibility == 'visible')
	    {
    	    alert('The User ID field is blank.');
	    }
	    if(document.getElementById('RequiredFieldValidator2').style.visibility == 'visible')
	    {
    	    alert('The Password field is blank.');
	    }
	    if(document.getElementById('nameRegex').style.visibility == 'visible')
	    {
    	    alert('The User ID has an invalid character.');
	    }
	    if(document.getElementById('RegularExpressionValidator1').style.visibility == 'visible')
	    {
    	    alert('The Password has an invalid character.');
	    }
	    return false;
	}
	else
	{
	if(document.layers) //The browser is Netscape 4
    {
        document.layers['Content'].document.forms[0].__VIEWSTATE.name = 'NOVIEWSTATE';
        document.layers['Content'].document.forms[0].__VIEWSTATE.value = '';
    
    }
    else //It is some other browser that understands the DOM
    {
        document.forms[0].__VIEWSTATE.name = 'NOVIEWSTATE';
        document.forms[0].__VIEWSTATE.value = '';
    }
    
	f=document.getElementById('form1');
	f.action="https://www.merchantcollect.com/Members/SecureRedirect.aspx"
	//f.action="/MerchCollect2.1/Members/SecureRedirect.aspx"
	f.method="post";
	f.encoding = "application/x-www-form-urlencoded";
    return true;
    }
}
// Used to display check image page
function displayImage(strPage)
{
    doLoad();
    var win=window.open(strPage,'mywin','width=920,height=675,toolbar=0,resizable=0,menubar=0,scrollbars=1');
    return false;
}
// Used to display report page
function displayReport(strPage)
{
    doLoad();
    var win=window.open(strPage,'mywin','width=920,height=675,toolbar=0,resizable=0,menubar=0,scrollbars=1');
    return false;
}
//Used to bring up support EMail page
function displayMail()
{
    doLoad();
    var win=window.open('EMailSupport.aspx','mywin','width=490,height=380,toolbar=0,resizable=0,menubar=0');
    return false;
}
//Used to bring up the contact update page
function displayContacts()
{
    doLoad();
    var win=window.open('ChangeContact.aspx','mywin','width=590,height=440,toolbar=0,resizable=0,menubar=0');
    return false;
}
//Used to bring up the change password page
function displayPassword()
{
    doLoad();
    var win=window.open('ChangePassword.aspx','mywin','width=530,height=370,toolbar=0,resizable=0,menubar=0');
    return false;
}
//Used to bring up the bank info page
function getbank(strwin)
{
    var win=window.open(strwin,'mywin','width=380,height=250,toolbar=0,resizable=0,menubar=0');
}
// Used to set the page timeout function
function doLoad()
{
    window.setTimeout('redirectLogin()', 1210000);
}
// Used to redirect back to the login page
function redirectLogin()
{
    window.location.href='http://www.merchantcollect.com/login.aspx';
}

var lastSelectedNum = -1
var lastSelectedTab = -1

function showTopic(num)
{
    if (lastSelectedNum >= 0)
    {
        // reset the last selected item
        var lastHeader = document.getElementById('h' + lastSelectedNum);
        var lastDetails = document.getElementById('d' + lastSelectedNum);
        
        lastHeader.style.backgroundColor = '#008000';
        lastHeader.style.color = '#eeeeee';
        lastHeader.style.borderBottomColor = '#008000';
        lastDetails.style.display = 'none';
    }
    
    var header = document.getElementById('h' + num);
    var details = document.getElementById('d' + num);
    
    header.style.backgroundColor = '#eeeeee';
    header.style.color = '#000000';
    header.style.borderBottomColor = '#ffffff';
    details.style.display = 'inline';
    
    lastSelectedNum = num;
}

function showTopicA(num1)
{
    if (lastSelectedTab >= 0)
    {
        // reset the last selected item
        var lastHeader = document.getElementById('ha' + lastSelectedTab);
        var lastDetails = document.getElementById('da' + lastSelectedTab);
        
        lastHeader.style.backgroundColor = '#008000';
        lastHeader.style.color = '#eeeeee';
        lastHeader.style.borderBottomColor = '#008000';
        lastDetails.style.display = 'none';
    }
    
    var header = document.getElementById('ha' + num1);
    var details = document.getElementById('da' + num1);
    
    header.style.backgroundColor = '#eeeeee';
    header.style.color = '#000000';
    header.style.borderBottomColor = '#ffffff';
    details.style.display = 'inline';
    
    lastSelectedTab = num1;
}

function hoverDiv(divItem, divNum, chgVal)
{
        var lastHeader = divItem;
        if (divNum != lastSelectedNum)
        {
            if (chgVal == 0)
            {           
                lastHeader.style.backgroundColor = '#EEE8AA';
                lastHeader.style.color = '#000000';
            }
            else
            {
                lastHeader.style.backgroundColor = '#008000';
                lastHeader.style.color = '#ffffff';
            }
        }
}

function hoverDiv2(divItem, divNum, chgVal)
{
        var lastHeader = divItem;
        if (divNum != lastSelectedTab)
        {
            if (chgVal == 0)
            {           
                lastHeader.style.backgroundColor = '#EEE8AA';
                lastHeader.style.color = '#000000';
            }
            else
            {
                lastHeader.style.backgroundColor = '#008000';
                lastHeader.style.color = '#ffffff';
            }
        }
}

function openScript(url, width, height) {
        var Win = window.open(url,"openScript",'width=' + width + ',height=' + height + ',resizable=yes,scrollbars=yes,menubar=yes,status=no' );
}

