﻿var sCurrentPage;

function _gtrack(category, action, label, value) {
    var _gaq = _gaq || [];
    _gaq.push(['_setAccount', 'UA-4009206-1']);
    _gaq.push(['_trackPageview', '/Users/Register/Confirmation']);

    (function () {
        var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;
        ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
        var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);
    })();

    // note: if an argument is passed to the _gaq.push method, it cannot be an empty string or null value. 
    //if (_gaq) {
    //    if (arguments.length > 3) _gaq.push(['_trackPageview', category, action, label, value]);
    //    else if (arguments.length > 2) _gaq.push(['_trackPageview', category, action, label]);
    //    else if (arguments.length > 1) _gaq.push(['_trackPageview', category, action]);
    //    else if (arguments.length > 0) _gaq.push(['_trackPageview', category]);
    //}
}

function URLDecode(sEncodedString)
{
    // Create a regular expression to search all +s in the string
    var sRegExp = /\+/g;
    // Return the decoded string
    return unescape(String(sEncodedString).replace(sRegExp, " "));
}

function GetPageHeight() {
  var b=document.body, e=document.documentElement;
  var esw=0, eow=0, bsw=0, bow=0, esh=0, eoh=0, bsh=0, boh=0;
  if (e) {
    esh = e.scrollHeight;
    eoh = e.offsetHeight;
  }
  if (b) {
    bsh = b.scrollHeight;
    boh = b.offsetHeight;
  }
  return Math.max(esh,eoh,bsh,boh);
}

function OpenWindow(sURL, nWidth, nHeight) {
		wContent=window.open(sURL,'wContent','left=100,top=100,screenX=100,screenY=100,width=' + nWidth + ',height=' + nHeight + ',scrollbars=no,location=no');
		wContent.focus();
}

function OpenScrollingWindow(sURL, nWidth, nHeight) {
    wContent = window.open(sURL, 'wContent', 'left=100,top=100,screenX=100,screenY=100,width=' + nWidth + ',height=' + nHeight + ',scrollbars=yes,location=no');
    wContent.focus();
}

function RemoveHash(sHashString) {
    return sHashString.substring(1,sHashString.length);
}

function GetScrollY() {
  var nScrollY = 0;
  if( typeof( window.pageYOffset ) == "number" ) {
    //Firefox compliant
    nScrollY = window.pageYOffset;
  } else if( document.body && ( document.body.scrollLeft || document.body.scrollTop ) ) {
    //DOM compliant
    nScrollY = document.body.scrollTop;
  } else if( document.documentElement && ( document.documentElement.scrollLeft || document.documentElement.scrollTop ) ) {
    //IE standards compliant mode
    nScrollY = document.documentElement.scrollTop;
  }
  return nScrollY;
}

function ValidateChecked(sender, e) {
    var oSender = getObject(sender.id.replace("cv_",""));
    
    if (oSender.checked) e.IsValid = true;
    else e.IsValid = false;
}

function ClearText(txtField){
    if (txtField.defaultValue==txtField.value) {
        txtField.value = "";
        txtField.style.color = "#000000";
        txtField.style.fontStyle = "normal";
    }
}

function FillText(txtField){
    if (txtField.value=="") {
        txtField.value = txtField.defaultValue;
        txtField.style.color = "#666666";
        txtField.style.fontStyle = "italic";
    }
}

function HighlightSelectText(ddlstField){
    ddlstField.style.color = "#000000";
    ddlstField.style.fontStyle = "normal";
}

function CreateCookie(name,value,days) {
    if (days) {
        var date = new Date();
        date.setTime(date.getTime()+(days*24*60*60*1000));
        var expires = "; expires="+date.toGMTString();
    }
    else var expires = "";
    document.cookie = name+"="+value+expires+"; path=/";
}
function ReadCookie(name) {
    var nameEQ = name + "=";
    var ca = document.cookie.split(';');
    for(var i=0;i < ca.length;i++) {
        var c = ca[i];
        while (c.charAt(0)==' ') c = c.substring(1,c.length);
        if (c.indexOf(nameEQ) == 0) return c.substring(nameEQ.length,c.length);
    }
    return null;
}

function EraseCookie(name) {
    CreateCookie(name,"",-1);
}
