var currentTextboxId = '';

function setCurrentOwnerTextboxId(textboxId)
{
	currentTextboxId = textboxId;
}

function WBC_SetHLink(strURL)
{ 
	document.getElementById(currentTextboxId).value = strURL;
}

function WBC_GetHLink()
{ 
	return document.getElementById(currentTextboxId).value;
}


function loadFile(filename, filetype)
{
	var ref;
	if (filetype=="text/javascript")
	{ 
		ref = document.createElement('script');
		ref.setAttribute("type","text/javascript");
		ref.setAttribute("src", filename);
	}
	else if (filetype=="text/css")
	{ 
		ref =document.createElement("link");
		ref.setAttribute("rel", "stylesheet");
		ref.setAttribute("type", "text/css");
		ref.setAttribute("href", filename);
	}
	if (typeof ref != "undefined")
		document.getElementsByTagName("head")[0].appendChild(ref);
}

function redirect(url)
{
	location.href = url;
}

function validateTextbox(id, type, message, defaultText)
{
	var textValue;
	var elm = document.getElementById(id);
	switch(type.toUpperCase())
	{
		case 'REQUIRED' : 
			textValue = elm.value;
			if(textValue == '' || textValue == defaultText)
			{	
				alert(message); 
				elm.value = '';
				elm.focus();
				return false; 
			}
			break;
		case 'MAILID' :
			textValue = elm.value;
			if(textValue == defaultText)
			{
				alert('Please enter your email address');
				elm.value = '';
				elm.focus();
				return false; 
			}
			else if (!(/\w{1,}[@][\w\-]{1,}([.]([\w\-]{1,})){1,3}$/.test(textValue)))
			{
				alert(message);
				elm.focus();
				return false;  
			}
			break;
	}	
	return true; 
}
