var websiteDomain = "tringme.com";
var websiteAccountDomain = "login.tringme.com";
var websitePath = "tringme.com";
var websiteAccountPath = "login.tringme.com";
var supportWebsiteURL = "tringmesupport.com";

var domain = window.location.host;
var myPath = window.location.pathname;

if(domain==websitePath || domain==websiteAccountPath ||domain==supportWebsiteURL ) {
	websitePath = "http://" + websitePath + '/';
	websiteAccountPath = "https://" + websiteAccountPath + '/';
	supportWebsiteURL = "http://" + supportWebsiteURL + '/';
} else {
	if(-1!=myPath.indexOf(websiteAccountPath))
		myPath = myPath.substr(0, myPath.indexOf(websiteAccountPath));
	if(-1!=myPath.indexOf(websitePath))
		myPath = myPath.substr(0, myPath.indexOf(websitePath));

	websitePath = "http://" + domain + myPath + websitePath + "/";
	websiteAccountPath = "http://" + domain + myPath + websiteAccountPath + "/";
	supportWebsiteURL = "http://" + domain + myPath + supportWebsiteURL + '/';
}

myPath = window.location.pathname;

var loginCookieName = "loginsession";
var viewCookieName = "viewsession";

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 clearText(thefield){
	if (thefield.defaultValue==thefield.value)
		thefield.value = ""
} 

//FUNCTION TO USE BEHALF OF getElementById
function getMyElement(elementId) {
	var element = null;
	if (document.all)
		element = document.all[elementId];
	else if (document.getElementById)
		element = document.getElementById(elementId);

	return element;
}

