﻿// JScript File



function searchSite()
{
    var searchText=document.getElementById('searchText');
    var url='/searchresults.aspx?domains=www.destroydebt.com&q=' + escape(searchText.value) + '&sa=Search&sitesearch=www.destroydebt.com&client=pub-6785640027858693&forid=1&ie=ISO-8859-1&oe=ISO-8859-1&cof=GALT%3A%23999999%3BGL%3A1%3BDIV%3A%23FFFFFF%3BVLC%3A999999%3BAH%3Acenter%3BBGC%3AFFFFFF%3BLBGC%3AFFFFFF%3BALC%3A444444%3BLC%3A444444%3BT%3A000000%3BGFNT%3A999999%3BGIMP%3A999999%3BFORID%3A11&hl=en';
    location.href=url;
}

function replyThread(threadId)
{
    window.open('/forum/replypopup.aspx?threadid=' + threadId, 'reply', 'width=600,height=500,menubar=no,resizable=no,scrollbars=no,titlebar=no,status=no,toolbar=no');
    return false;
}

function comment(contentType, contentId)
{
    window.open('/comments/comment.aspx?contenttype=' + contentType + '&contentid=' + contentId, 'comment', 'width=600,height=500,menubar=no,resizable=no,scrollbars=no,titlebar=no,status=no,toolbar=no');
    return false;
}

function moderate(contentType, contentId)
{
    window.open('/cp/moderate' + contentType + '.aspx?id=' + contentId, 'moderate', 'width=500,height=500,menubar=no,resizable=no,scrollbars=no,titlebar=no,status=no,toolbar=no');
    return false;
}

function reviewCompany(companyId)
{
    window.open('/companies/postreview.aspx?companyid=' + companyId, 'review', 'width=600,height=500,menubar=no,resizable=no,scrollbars=no,titlebar=no,status=no,toolbar=no');
    return false;
}

function loginKeyDown(e, usernameControlName, passwordControlName)
{
    var keynum;
    if(window.event) // IE
    {
        keynum = window.event.keyCode;
    }
    else
    {
        keynum = e.keyCode;
    }
    
    //alert(keynum);
    if (keynum==13)
    {
        login(usernameControlName, passwordControlName);
        return false;
    } else {
        return true;
    }
}

function login(usernameControlName, passwordControlName)
{
    var usernameControl=document.getElementById(usernameControlName);
    var passwordControl=document.getElementById(passwordControlName);
    var username=usernameControl.value;
    var password=passwordControl.value;
    
    
    var f=document.createElement("form");
    var h1=document.createElement("input");
    var h2=document.createElement("input");
    var h3=document.createElement("input");

    f.id='loginForm';
    f.method='post';
    f.action='/cp/login.aspx';

    h1.type='hidden';
    h1.name='username';
    h1.value=username;
    
    h2.type='hidden';
    h2.name='password';
    h2.value=password;
    
    h3.type='hidden';
    h3.name='returnurl';
    h3.value=location.href;
    
    document.body.appendChild(f);
    f.appendChild(h1);
    f.appendChild(h2);
    
    f.submit();
}

function defaultTextFocus(c)
{
    if (c.className=='default' || c.className=='defaultPassword')
    {
        c.className='';
        c.value='';
        //try {
            //if (c.id.indexOf('Password')>-1) c.type='password';
        //} finally {}
    }
}

function toggleBriefcase()
{
    var bcw=document.getElementById('briefcaseWrapper');
    var bcc=document.getElementById('briefcaseContent');
   
    if (bcw.className=='briefcaseWrapper')
    {
        bcw.className='briefcaseWrapperCollapsed';
        bcc.innerHTML='';
    } else {
        bcw.className='briefcaseWrapper';
        getBriefcaseContents();
    }
}

function getBriefcaseContents()
{
    var url='/ajax/briefcase.aspx';
    if (window.XMLHttpRequest) {
        frmReq = new XMLHttpRequest();
        frmReq.onreadystatechange = processBriefcase;
        frmReq.open("GET", url, true);
        frmReq.send(null);
    // branch for IE/Windows ActiveX version
    } else if (window.ActiveXObject) {
        frmReq = new ActiveXObject("Microsoft.XMLHTTP");
        if (frmReq) {
            frmReq.onreadystatechange = processBriefcase;
            frmReq.open("GET", url, true);
			frmReq.send();
        }
    }
}

function processBriefcase(){
	if (frmReq.readyState == 4) {
		if (frmReq.status == 200) {
		    var bcc=document.getElementById('briefcaseContent');
		    bcc.innerHTML=frmReq.responseText
        } else {
            alert("There was a problem retrieving the data:\n" + frmReq.statusText);
        }
	}
}

function showApplyForm()
{
    document.write('<h2>Debt Counseling</h2>\n');
    document.write('<iframe width=\"160\" height=\"600\" frameborder=\"0\" src=\"/applyform.htm\" ></iframe>');
}

function showApplyForm2()
{
    document.write('<iframe width=\"820\" height=\"476\" frameborder=\"0\" src=\"/applyform2.htm\" scrolling=\"no\" ></iframe>');
}

function showSolutions(section)
{
    var url='/ajax/solutions.aspx?section=' + section;
    if (window.XMLHttpRequest) {
        frmReq = new XMLHttpRequest();
        frmReq.onreadystatechange = processSolutions;
        frmReq.open("GET", url, true);
        frmReq.send(null);
    // branch for IE/Windows ActiveX version
    } else if (window.ActiveXObject) {
        frmReq = new ActiveXObject("Microsoft.XMLHTTP");
        if (frmReq) {
            frmReq.onreadystatechange = processSolutions;
            frmReq.open("GET", url, true);
			frmReq.send();
        }
    }
}

function processSolutions(){
	if (frmReq.readyState == 4) {
		if (frmReq.status == 200) {
		    var bcc=document.getElementById('solutionsHolder');
		    var responseHtml=frmReq.responseText;
		    var newdiv = document.createElement("div");
            newdiv.innerHTML = responseHtml; 
		    bcc.innerHTML=''; 
		    bcc.appendChild(newdiv);
        } else {
            alert("There was a problem retrieving the data:\n" + frmReq.statusText);
        }
	}
}


function setCookie( name, value, expires) 
{
    var today = new Date();
    today.setTime( today.getTime() );
    expires = expires * 1000 * 60 * 60 * 24;
    var expires_date = new Date( today.getTime() + (expires) );
    document.cookie = name + "=" +escape( value ) +
    ";expires=" + expires_date.toGMTString();
}


function showDisclaimer()
{
    var result='<p><img src="/images/informa.gif" width="75" align="left" style="margin-right:10px;margin-bottom:5px;">The rate information on this page is powered by <a href="http://www.informars.com/" rel="noindex,nofollow">Informa Research Services, Inc.</a> &copy; 2008. This information has been obtained from various financial institutions, and Informa Research Services cannot guarantee its accuracy. The information includes financial product data that was in the Informa Research Services database at the time of publication, and may not reflect all of the products available in your region. Before acting on the information shown on this page, contact the financial institution to verify the accuracy of the data. When contacting financial institutions, always mention DestroyDebt.com to ensure you receive the preferred Internet rate. Contact <a href="mailto:links@informars.com" rel="noindex,nofollow">links@informars.com</a> to have your rates included in this chart.</p>';
    document.write(result);
}

function trackHit(type,id)
{
    document.write('<img src="/trackhit.aspx?contenttype=' + type + '&contentId=' + id + '" width="0" height="0">');
}

function addLink(contentType, contentId, linkType)
{
    window.open('/cp/addlink.aspx?contenttype=' + contentType + '&contentid=' + contentId + '&linkType=' + linkType, 'comment', 'width=600,height=500,menubar=no,resizable=no,scrollbars=no,titlebar=no,status=no,toolbar=no');
    return false;
}


function showApplyAd()
{
    var url='/ajax/applyad.aspx';
    if (window.XMLHttpRequest) {
        frmReq = new XMLHttpRequest();
        frmReq.onreadystatechange = processApplyAd;
        frmReq.open("GET", url, true);
        frmReq.send(null);
    // branch for IE/Windows ActiveX version
    } else if (window.ActiveXObject) {
        frmReq = new ActiveXObject("Microsoft.XMLHTTP");
        if (frmReq) {
            frmReq.onreadystatechange = processSolutions;
            frmReq.open("GET", url, true);
			frmReq.send();
        }
    }
}

function processApplyAd(){
	if (frmReq.readyState == 4) {
		if (frmReq.status == 200) {
		    var bcc=document.getElementById('applyAdHolder');
		    bcc.innerHTML=frmReq.responseText;
        } else {
            alert("There was a problem retrieving the data:\n" + frmReq.statusText);
        }
	}
}

