
function hidediv(divElem) { 
	if (document.getElementById) { // DOM3 = IE5, NS6 
		document.getElementById(divElem).style.display = 'none'; 
	} else { 
		if (document.layers) { // Netscape 4 
			document.divElem.visibility = 'hidden'; 
		} else { // IE 4 
			document.all.divElem.style.visibility = 'hidden'; 
		} 
	} 
} 

function showdiv(divElem) { 
	//alert(divElem)
	if (document.getElementById) { // DOM3 = IE5, NS6 
		document.getElementById(divElem).style.display = ''; 
		//alert("dong")
	} else { 
		if (document.layers) { // Netscape 4 
			document.divElem.visibility = 'visible'; 
		} 
		else { // IE 4 
			document.all.divElem.style.visibility = 'visible'; 
		} 
	} 
} 

function CloseDirectoryPayWindow(targetPage)
{   
    //parent.window.location='http://www.masterseek.com'    
    //window.opener.location.reload();
    window.opener.location.href = targetPage 
    window.close();
}

function open_DIBS_window()
{
	var iWinState = 1;
	var objForm = null;
	
	if(document.DIBS)
		objForm = document.DIBS;
	else	
		objForm = document.getElementById("DIBS");
	
	if(objForm.windowstate)	
		iWinState = objForm.windowstate.value;
	
	if (iWinState == "1")
	{
		//popup window
		var DIBSwin = window.open("","DIBS_window","height=600,width=525,menubar=0,resizable=1,scrollbars=1,status=1,titlebar=0,toolbar=0,left=100,top=50");
	
		if (DIBSwin)
			DIBSwin.focus();
			
		objForm.target = "DIBS_window";
	}
	else
		objForm.target = "";
	
	objForm.submit();
}
	
function DirectoryPayFormSubmit()
{ 
  var x=document.getElementById("DirectoryPayForm")  
  x.submit()

  
}
 

 	
  	
function popWin(theURL,winName,width,height) { 
    var window_width = width;
    var window_height = height;
    var window_top = (screen.height-window_height)/2;
    var window_left = (screen.width-window_width)/2;
    newWindow=window.open(''+ theURL + '',''+ winName + '','width=' + window_width + ',height=' + window_height + ',top=' + window_top + ',left=' + window_left + ', toolbar=no,location=no,status=yes,menubar=no,scrollbars=yes,resizable=yes');
}

function popWinFixed(theURL,winName,width,height) { 
    var window_width = width;
    var window_height = height;
    var window_top = (screen.height-window_height)/2;
    var window_left = (screen.width-window_width)/2;
    newWindow=window.open(''+ theURL + '',''+ winName + '','width=' + window_width + ',height=' + window_height + ',top=' + window_top + ',left=' + window_left + ', toolbar=no,location=no,status=no,menubar=no,scrollbars=no,resizable=no');
}

function cloWin() {
	window.close();
	window.opener.focus();
}
function cloWinAuto(iTime) {
	// Close window after 2000 ms (2 sec.)
	setTimeout('cloWin()', iTime);	
}

function textCounter(field, displayName, maxlimit, countfield) {
    if (field.value.length > maxlimit) {
        field.value = field.value.substring( 0, maxlimit );
        alert(displayName + ' cannot exceed ' + maxlimit + ' characters in length.' );
        return false;
    }
    else if (countfield) {  // can have an input field that shows the count to the user, don't pass countfield to ignore this
        countfield.value = maxlimit - field.value.length;
        
    }
    return true ;
}

function clickButton(e, buttonid)
{ 
	var evt = e ? e : window.event;
	var bt = document.getElementById(buttonid);
	if (bt)
	{ 
		if (evt.keyCode == 13)
		{ 
			bt.click(); 
			return false; 
		} 
	} 
}