function select_all(element, value)
{
	//var text_val=eval("document.formInsertItem.title");
	var text_val=eval(element);
	text_val.focus();
	text_val.select();
	if(text_val.value == value)
		text_val.value = "";
}

function show_text(element, value)
{
	//var text_val=eval("document.formInsertItem.title");
	var text_val=eval(element);
	if(text_val.value == "")
	{
		text_val.value = value;
	}
}

String.prototype.trim = function() {
    return this.replace(/^\s+|\s+$/g, "");
};

function echeck(str) 
{
		var at="@"
		var dot="."
		var lat=str.indexOf(at)
		var lstr=str.length
		var ldot=str.indexOf(dot)
		if (str.indexOf(at)==-1){return false}
		if (str.indexOf(at)==-1 || str.indexOf(at)==0 || str.indexOf(at)==lstr){return false}
		if (str.indexOf(dot)==-1 || str.indexOf(dot)==0 || str.indexOf(dot)==lstr){return false}
		if (str.indexOf(at,(lat+1))!=-1){return false}
		if (str.substring(lat-1,lat)==dot || str.substring(lat+1,lat+2)==dot){return false}
		if (str.indexOf(dot,(lat+2))==-1){return false}
		if (str.indexOf(" ")!=-1){return false}
 		 return true					
}

function limitText(limitField, limitNum) 
{
	if (limitField.value.length > limitNum) 
	{
		limitField.value = limitField.value.substring(0, limitNum);
	} 
}


function openpopup(popurl){
var winpops=window.open(popurl,"","width=400px,height=400px,align=center,status,resizable=0,scrollbars=1")
}


/* Modified to support Opera */
function bookmarksite(title,url){
if (window.sidebar) // firefox
	window.sidebar.addPanel(title, url, "");
else if(window.opera && window.print){ // opera
	var elem = document.createElement('a');
	elem.setAttribute('href',url);
	elem.setAttribute('title',title);
	elem.setAttribute('rel','sidebar');
	elem.click();
} 
else if(document.all)// ie
	window.external.AddFavorite(url, title);
}
