
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; 
		} 
	} 
}


////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
//////   Top Control Tabs Functionality Starts
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

//=============================================================
//Handling when the user clicks a tab at the top menu
//=============================================================
function clicktab(tabnr) 
{
      switch (tabnr)
      {
      case 1:
         //Quick search         
         document.getElementById("ctl00_top_tab_ProductSearch").style.color = "#b4b4b4";
         document.getElementById("ctl00_top_tab_CompanySearch").style.color = "#b4b4b4";     
         document.getElementById("ctl00_top_tab_PeopleSearch").style.color = "#b4b4b4";
         document.getElementById("ctl00_top_tab_MarketWireNews").style.color = "#b4b4b4";              
         document.getElementById("ctl00_top_txt_SearchType").value = "1";       
         break;
      case 2:
         //Product Search         
         document.getElementById("ctl00_top_tab_quick").style.color = "#b4b4b4";
         document.getElementById("ctl00_top_tab_CompanySearch").style.color = "#b4b4b4";     
         document.getElementById("ctl00_top_tab_PeopleSearch").style.color = "#b4b4b4";
         document.getElementById("ctl00_top_tab_MarketWireNews").style.color = "#b4b4b4";   
         document.getElementById("ctl00_top_txt_SearchType").value = "3";      
         break;
      case 3:
         //Company search         
         document.getElementById("ctl00_top_tab_quick").style.color = "#b4b4b4";
         document.getElementById("ctl00_top_tab_ProductSearch").style.color = "#b4b4b4";
         document.getElementById("ctl00_top_tab_PeopleSearch").style.color = "#b4b4b4";
         document.getElementById("ctl00_top_tab_MarketWireNews").style.color = "#b4b4b4";     
         document.getElementById("ctl00_top_txt_SearchType").value = "0";               
         break;
      case 4:
         // People Search         
         document.getElementById("ctl00_top_tab_quick").style.color = "#b4b4b4";
         document.getElementById("ctl00_top_tab_ProductSearch").style.color = "#b4b4b4";
         document.getElementById("ctl00_top_tab_CompanySearch").style.color = "#b4b4b4";   
         document.getElementById("ctl00_top_tab_MarketWireNews").style.color = "#b4b4b4";     
         document.getElementById("ctl00_top_txt_SearchType").value= "9";               
         break;
       case 5:
         // MarketWire News         
         document.getElementById("ctl00_top_tab_quick").style.color = "#b4b4b4";
         document.getElementById("ctl00_top_tab_ProductSearch").style.color = "#b4b4b4";
         document.getElementById("ctl00_top_tab_CompanySearch").style.color = "#b4b4b4";     
         document.getElementById("ctl00_top_tab_MarketWireNews").style.color = "#b4b4b4";     
         document.getElementById("ctl00_top_txt_SearchType").value = "50";               
         break;         
      default:
      }

   
   if (tabnr < 6)
   {
   switch (GetSel("ctl00_top_SelOther", 15).toString())
   {
      case '1':
         document.getElementById("ctl00_top_img_tabbox_background1").style.visibility = "hidden";
         break;
      case '2':
         document.getElementById("ctl00_top_img_tabbox_background2").style.visibility = "hidden";
         break;
      case '3':
         document.getElementById("ctl00_top_img_tabbox_background3").style.visibility = "hidden";
         break;
      case '4':
         document.getElementById("ctl00_top_img_tabbox_background4").style.visibility = "hidden";
         break;
      case '5':
         document.getElementById("ctl00_top_img_tabbox_background5").style.visibility = "hidden";
         break;               
      default:      
   }
   document.getElementById("ctl00_top_img_tabbox_background" + tabnr).style.visibility = "visible"; 
   SetSel("ctl00_top_SelOther", 15, tabnr);
   }
}

//=============================================================
//Sub function: Get a single setting char from the hidden input box named sel
//=============================================================
function GetSel(Sel, PositionNr) 
//base 1 when calling the function
{
      var MyCtrl = document.getElementById(Sel);
      return MyCtrl.value.substring(PositionNr,PositionNr+1);
}

//=============================================================
//Sub function: Set a single setting char from the hidden input box named sel
//=============================================================
function SetSel(Sel, PositionNr, ReplacingChar)
//base 1 when calling the function
{
      var MyCtrl = document.getElementById(Sel);
      MyCtrl.value = MyCtrl.value.substring(0,PositionNr) + ReplacingChar + MyCtrl.value.substring(PositionNr+1);
}
//=============================================================
//Handling when the user touches the tabs at the top menu 
//=============================================================
function mouseovertab(tabnr) 
{
      switch (tabnr)
      {
      case 1:
        document.getElementById("ctl00_top_tab_quick").style.color = "#ffffff";
        break;
      case 2:
        document.getElementById("ctl00_top_tab_ProductSearch").style.color = "#ffffff";
        break;     
      case 3:
         //Company Search
         document.getElementById("ctl00_top_tab_CompanySearch").style.color = "#ffffff";
         break;
      case 4:
         //People Search
         document.getElementById("ctl00_top_tab_PeopleSearch").style.color = "#ffffff";      
         break;   
      case 5:
         //MarketWire News
         document.getElementById("ctl00_top_tab_MarketWireNews").style.color = "#ffffff";      
         break;            
      default:
      ;
      }
} 

//=============================================================
//Handling when the user leaves the touch of the tabs at the top menu 
//=============================================================
function mouseouttab(tabnr) 
{
      var tabnow = 0;
      switch (tabnr)
      {
      case 1:
        if (tabnow != '1')
        {
        document.getElementById("ctl00_top_tab_quick").style.color = "#b4b4b4";
        }
      break;
      case 2:
        if (tabnow != '2')
        {
        document.getElementById("ctl00_top_tab_ProductSearch").style.color = "#b4b4b4";
        }
      break;
      case 3:
         //Company Search
         if (tabnow != '3')
        {
            document.getElementById("ctl00_top_tab_CompanySearch").style.color = "#b4b4b4";
        }         
         break;
      case 4:
         //People Search
        if (tabnow != '4')
        {
            document.getElementById("ctl00_top_tab_PeopleSearch").style.color = "#b4b4b4";
        }         
         break;   
     case 5:
         //MarketWire News
        if (tabnow != '5')
        {
            document.getElementById("ctl00_top_tab_MarketWireNews").style.color = "#b4b4b4";
        }         
         break;       
         
      default:
      ;
      }
}
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
//////   Top Control Tabs Functionality Ends
//////   Masterseek Edition Area Starts
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
function OpenMasterseekEditionAreaTopControl()
{
     document.getElementById("ctl00_top_MasterseekEditions").style.visibility = "visible";
}

function CloseMasterseekEditionAreaTopControl()
{
     document.getElementById("ctl00_top_MasterseekEditions").style.visibility = "hidden";
}

function changeEditionrowColorTopControl(i) {                   
    document.getElementById("ctl00_top_tr" + i).style.backgroundColor=  "#0096ca";              
}

function changeNoEditionrowColorTopControl(i) {        
    document.getElementById("ctl00_top_tr" + i).style.backgroundColor=  "";
}
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
//////   Masterseek Edition Area Ends
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////