﻿function showStartNowInfo()
{
    var body = document.getElementsByTagName("body")[0];
    var left = $('header').getLeft();
    var startNowInfo = new Element('div', {
                                'id':'startNowInfo',
                                'styles': {
                                    'opacity': 0,
                                    'position':'absolute',
                                    'width':450,
                                    'height':250,
                                    'top':350,
                                    'left':left + 145,
                                    'z-index':'99999',
                                    'background':'#cde2ec url("/resources/images/bg.gif") repeat-x 0 0',
                                    'padding': '10px',
                                    'border':'6px solid #F8C013',
                                    'border-top':'0',
                                    'color':'#565551'
                                  
                            }}).injectInside(body);
                            
    var closeImg = new Element('img', {'src': '/resources/images/close_x.gif', 'styles':{'position':'absolute', 'z-index':999, 'top':15, 'right':6}, 'events':{'click':function(){hideLayer('startNowInfo');}}}).injectInside(startNowInfo);
    var startNowHead = new Element('p', {'styles':{'font-size':18, 'color':'#1daccd','padding-top':10,'padding-bottom':10}}).setHTML('Create a New Account').injectAfter(closeImg);
    var p2 = new Element('p', {'styles':{'text-align':'center', 'margin-top':30}}).setHTML('<img src="/resources/images/layer_adv.gif" alt="advertisers" />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<a href="/advertisers.html#advForm" style="border:0;"><img src="/resources/images/layer_go.gif" style="position:relative; top:-5px;" alt="go" /></a>').injectAfter(startNowHead);
    var p3 = new Element('p', {'styles':{'padding-top':30, 'text-align':'center'}}).setHTML('<img src="/resources/images/layer_pub.gif" alt="publishers" />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<a href="/publishers.html#pubForm" style="border:0;"><img src="/resources/images/layer_go.gif" style="position:relative; top:-5px;" alt="go" /></a>').injectAfter(p2);
    
    var myFx = new Fx.Style('startNowInfo', 'opacity', {
                            duration: 500, 
                            transition: Fx.Transitions.Quart.easeInOut});
    myFx.start(0,1); 
    
}

function showEmailSent()
{
    var body = document.getElementsByTagName("body")[0];
    var left = $('header').getLeft();
    var emailSent = new Element('div', {
                                'id':'emailSent',
                               'styles': {
                                    'opacity': 0,
                                    'position':'absolute',
                                    'width':450,
                                    
                                    'top':350,
                                    'left':left + 145,
                                    'z-index':'99999',
                                    'background':'#cde2ec url("/resources/images/bg.gif") repeat-x 0 0',
                                    'padding': '10px',
                                    'border':'6px solid #F8C013',
                                    'border-top':'0',
                                    'color':'#565551'
                                  
                            }}).injectInside(body);
                            
    var closeImg = new Element('img', {'src': '/resources/images/close_x.gif', 'styles':{'position':'absolute', 'z-index':999, 'top':15, 'right':6}, 'events':{'click':function(){hideLayer('emailSent');}}}).injectInside(emailSent);
    var emailSentHead = new Element('p', {'styles':{'font-size':18, 'color':'#1daccd', 'padding-top':10, 'padding-bottom':10}}).setHTML('Proposal Has Been Sent').injectAfter(closeImg);
    var p2 = new Element('p').setHTML('Your request has been delivered to SureHits.').injectAfter(emailSentHead);
    var p3 = new Element('p', {'styles':{'padding-top':15}}).setHTML('A representative will be in contact within the next business day.').injectAfter(p2);
    
    var myFx = new Fx.Style('emailSent', 'opacity', {
                            duration: 500, 
                            transition: Fx.Transitions.Quart.easeInOut});
    myFx.start(0,1); 
    
}




function hideLayer(id)
{

    var myFx = new Fx.Style($(id), 'opacity', {
                            duration: 500, 
                            transition: Fx.Transitions.Quart.easeInOut,
                            onComplete:function(){$(id).remove();}});
    myFx.start(1,0); 
}



function getQueryStringVariable(variable) {
var query = window.location.search.substring(1);
var vars = query.split('&');
for (var i=0;i<vars.length;i++) {
var pair = vars[i].split('=');
if (pair[0] == variable) {
return pair[1];}}}


function checkLogin()
{
    var error = '';
    if ($('username').getValue() == "")
        error += 'Please Enter Your Username.\n';
    
    if ($('password').getValue() == "")
        error += 'Please Enter Your Password.\n';
        
    if (error == '')
        $('Login').submit();
    else
    {
        alert(error);
        return false;
    }
          
}