function clearSearch()
{	
	if ($F('searchText') == 'ENTER KEYWORD(S)') $('searchText').value = '';
}

function showHideElement(elName)
{
	var el = document.getElementById(elName);
	if(el.style.display == 'none')
	{
		new Effect.BlindDown(el);
	}
	else
	{
		new Effect.BlindUp(el);
	}
}

Event.observe( window, 'load', function() {
// Put the Javascript that needs to happen when the page
// loads here
	Event.observe('searchText', 'focus', clearSearch);
} );

function isInt(x) {
	var y = parseInt(x);
	if (isNaN(y) || isNaN(x)) {
		return false;
	}
	return x == y && x.toString() == y.toString();
}

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

function handleQuantityChangeForInputQuantity(id, msgID) {

    $(id).value = $F(id).trim();

    if (!$F(id) || !isInt($F(id))|| $F(id) <= 0) {
        if (!$(msgID).visible()) {
            new Effect.Appear(msgID);
        }
        $(id).style.border = '2px solid red';
    } else {
        if ($(msgID).visible()) {
            new Effect.Fade(msgID);
        }
        $(id).style.border = '2px solid #a5acb2';
    }
}

function openWindow(url, name) {
    var wndLeft = (screen.width - 400) / 2;
    var wndTop = (screen.height - 200) / 2;
    window.open(url, name, "height=200,width=400,scrollbars=yes,status=no,toolbar=no,menubar=no,location=no,top=" + wndTop + ",left=" + wndLeft);
    return;
}
function openWindow2(url, name, width, height) {
    var wndLeft = (screen.width - width) / 2;
    var wndTop = (screen.height - height) / 2;
    window.open(url, name, "height=" + height + ",width=" + width + ",scrollbars=no,status=no,toolbar=no,menubar=no,location=no,top=" + wndTop + ",left=" + wndLeft);
    return;
}
function openScrollableWindow(url, name, width, height) {
    var wndLeft = (screen.width - width) / 2;
    var wndTop = (screen.height - height) / 2;
    window.open(url, name, "height=" + height + ",width=" + width + ",scrollbars=1,status=no,toolbar=no,menubar=no,location=no,top=" + wndTop + ",left=" + wndLeft);
    return;
}

function toggleTributeOtherAmount(amount,otherAmount){
    if(amount.value.toUpperCase()=="OTHER"){
        otherAmount.disabled=false;
    }
    else{
        otherAmount.value="";
        otherAmount.disabled=true;
    }
}

function show(divname){
   var mydiv = document.getElementById(divname);
   mydiv.style.visibility="";
   mydiv.style.display="";
}
function hide(divname){
   var mydiv = document.getElementById(divname);
   mydiv.style.visibility="";
   mydiv.style.display="none";
}


