﻿
function ClearDefault(control)
{
	if(control.value == control.attributes.getNamedItem("DefaultText").value)
	{
		control.value = "";
	}
}

function RestoreDefault(control)
{
	if(control.value=="")
	{
		control.value=control.attributes.getNamedItem("DefaultText").value;
	}
}

function StopReturnKey(evt) 
{
    if (evt.keyCode == 13) 
    {
        evt.preventDefault();
        evt.stopImmediatePropagation();
    }
}

function AdjustTextarea(textarea) 
{
    if (textarea.scrollHeight > textarea.offsetHeight)
        textarea.style.height = textarea.scrollHeight + "px";
}

function IsProduction()
{
	var url = new String(document.location);
	if( url.indexOf("www.svb.com") == -1)
		return false;
	else
		return true;
}

/*
category (required) - The name you supply for the group of objects you want to track.

action (required) - A string that is uniquely paired with each category, and commonly used to define the type of user interaction for the web object. 

label (optional) - An optional string to provide additional dimensions to the event data
*/
function GoogleTrackEvent(category, action, label) 
{
    var pageTracker = _gat._getTracker("UA-84999-1");
    pageTracker._initData();
    pageTracker._trackEvent(category, action, label);
}

function RecordExitLink(obj, category, action, label) 
{
    var delay = 0;
    try 
    {
        if (IsProduction()) 
        {
            GoogleTrackEvent(category, action, label);
            // give time for the tracking to register
            delay = 100;
        }
    }
    catch(err) {}
	setTimeout('document.location = "' + obj.href + '"', delay);
}
function RecordEvent(category, action, label) {
    try 
    {
        if (IsProduction())
        {
            GoogleTrackEvent(category, action, label);
        }
    }
    catch (err) { }
} 