

function OnFocus(Obj, Text, Enter) {
    if (Enter) {
        if (Obj.value == Text) {
            Obj.value = '';
            Obj.style.color = '#000';
        } else if (Obj.value == '') {
            Obj.value = Text;
            Obj.style.color = '#000';
        }
    } else {
        if (Obj.value == '') {
            Obj.value = Text;
            Obj.style.color = '#aaa';
        } else if (Obj.value == Text) {
            Obj.value = Text;
            Obj.style.color = '#aaa';
        }
    }
}
function SetPageTheme(Option, Value, Path){
	var links = document.getElementsByTagName('link');
	var found = null;
	var next = null;
    var i;
    for(i = 0; i < links.length; i++) {
        link = links[i];
        var s = link.getAttribute('rel');
        if (s == 'stylesheet') {
            s = link.getAttribute('title');
            if (s == 'System.Themes.' + Option) {
                s = link.getAttribute('href');
                link.setAttribute('href', Path + 'Themes.' + Option + '.' + Value + '.css');
                break;
            }
        } else {
            alert('New Link Type: "' + s + '".');
        }
	}
}
function SetCookie(Name, Value, Days) {
    Days = Days || 30;
    var e = '';
	if (Days) {
		var date = new Date();
		date.setTime(date.getTime() + (Days*24*60*60*1000));
		e = '; expires=' + date.toGMTString();
	}
	document.cookie = Name + '=' + escape(Value) + e;
}
function GetCookie(Name) {
	var n = Name + '=';
	var c = document.cookie.split(';');
	for(var i=0; i < c.length; i++) {
		var e = c[i];
		while (e.charAt(0) == ' ') e = e.substring(1, e.length);
		if (e.indexOf(n) == 0) return e.substring(n.length, e.length);
	}
	return null;
}
function ShowDiv(Id) {
    var e = document.getElementById(Id);
    if (e.style.display == 'none') {
        e.style.display = 'block';
    } else {
        e.style.display = 'none';
    }
}
