﻿var t;

function social_open() {
	clearInterval(t);
	document.getElementById('socialdiv').style.visibility = 'visible';
	document.getElementById('socialdiv').style.left = getRealLeft('mainsocialdiv') - 60 + 'px';
	document.getElementById('socialdiv').style.top = getRealTop('mainsocialdiv') - 180 + 'px';
}

function social_close() {
    t = setInterval(social_reallyclose, 300);
}


function social_reallyclose() {
	document.getElementById('socialdiv').style.visibility = 'hidden';
	clearInterval(t);
}


function getRealLeft(el)
{
    xPos = document.getElementById(el).offsetLeft;
    tempEl = document.getElementById(el).offsetParent;
    while (tempEl != null) {
    xPos += tempEl.offsetLeft;
    tempEl = tempEl.offsetParent;
    }
    return xPos;
}


function getRealTop(el)
{
    yPos = document.getElementById(el).offsetTop;
    tempEl = document.getElementById(el).offsetParent;
    while (tempEl != null) {
    yPos += tempEl.offsetTop;
    tempEl = tempEl.offsetParent;
    }
    return yPos;
}


function AddFav()
{ alert('Please Press CTRL+D To Bookmark This Site.') } 

function doClick(e, buttonid){
var evt = e ? e : window.event;
var bt = document.getElementById(buttonid);
if (bt){
if (evt.keyCode == 13){
bt.click();
return false;
}
}
}

function ValidateCC(sender, args) 
{
    //Checks to see if the input field has been changes and if so, valudates the creditcard number
    var oldvalue = document.getElementById("ctl00_contentBody_HiddenFieldCC");
    var CCInput = args.Value;
    var CCRegex = /^((4\d{3})|(5[1-5]\d{2})|(6011))-?\d{4}-?\d{4}-?\d{4}|3[4,7][\d\s-]{13}$/;

    if (oldvalue.value != '' && oldvalue.value == CCInput) 
    {
        //Nothing has changed, so let it through
         args.IsValid = true;
         return true;
    }
    else
    {
         if( !CCInput.match( CCRegex ) ) 
         {
            args.IsValid = false;
            return false;
         }
         args.IsValid = true;
         return true;
    }
      

}

/* 
------------------------------------------------
PVII Equal CSS Columns scripts -Version 2
Copyright (c) 2005 Project Seven Development
www.projectseven.com
Version: 2.1.0
------------------------------------------------
*/
function P7_colH2() { //v2.1.0 by PVII-www.projectseven.com
    var i, oh, h = 0, tg, el, np, dA = document.p7eqc, an = document.p7eqa; if (dA && dA.length) {
        for (i = 1; i < dA.length; i += 2) { dA[i + 1].style.paddingBottom = ''; } for (i = 1; i < dA.length; i += 2) {
            oh = dA[i].offsetHeight; h = (oh > h) ? oh : h;
        } for (i = 1; i < dA.length; i += 2) {
            oh = dA[i].offsetHeight;
            if (oh < h) {
                np = h - oh; if (!an && dA[0] == 1) { P7_eqA2(dA[i + 1].id, 0, np); } else {
                    dA[i + 1].style.paddingBottom = np + "px";
                } 
            } 
        } document.p7eqa = 1;
        document.p7eqth = document.body.offsetHeight;
        document.p7eqtw = document.body.offsetWidth;
    }
}
function P7_eqT2() { //v2.1.0 by PVII-www.projectseven.com
    if (document.p7eqth != document.body.offsetHeight || document.p7eqtw != document.body.offsetWidth) { P7_colH2(); }
}
function P7_equalCols2() { //v2.1.0 by PVII-www.projectseven.com
    var c, e, el; if (document.getElementById) {
        document.p7eqc = new Array();
        document.p7eqc[0] = arguments[0]; for (i = 1; i < arguments.length; i += 2) {
            el = null;
            c = document.getElementById(arguments[i]); if (c) {
                e = c.getElementsByTagName(arguments[i + 1]);
                if (e) { el = e[e.length - 1]; if (!el.id) { el.id = "p7eq" + i; } } 
            } if (c && el) {
                document.p7eqc[document.p7eqc.length] = c; document.p7eqc[document.p7eqc.length] = el
            } 
        }
        setInterval("P7_eqT2()", 10);
    }
}
function P7_eqA2(el, p, pt) { //v2.1.0 by PVII-www.projectseven.com
    var sp = 10, inc = 20, g = document.getElementById(el); np = (p >= pt) ? pt : p;
    g.style.paddingBottom = np + "px"; if (np < pt) {
        np += inc;
        setTimeout("P7_eqA2('" + el + "'," + np + "," + pt + ")", sp);
    }
}

function setCookie(c_name, value, expiredays) {
    var exdate = new Date();
    exdate.setDate(exdate.getDate() + expiredays);
    document.cookie = c_name + "=" + escape(value) +
((expiredays == null) ? "" : ";expires=" + exdate.toGMTString() + ";path=/");
}
function getCookie(c_name) {
    if (document.cookie.length > 0) {
        c_start = document.cookie.indexOf(c_name + "=");
        if (c_start != -1) {
            c_start = c_start + c_name.length + 1;
            c_end = document.cookie.indexOf(";", c_start);
            if (c_end == -1) c_end = document.cookie.length;
            return unescape(document.cookie.substring(c_start, c_end));
        }
    }
    return "";
}