﻿function openWin( windowURL, windowName, windowFeatures) {
     window.open( windowURL, windowName, windowFeatures ) ;
}

//search stuff
function validateSearchForm(control_id)
{
    var valid = true;
  
    if (document.getElementById(control_id).value.length == 0 ) {
 	    window.alert ("Please enter a search text.");
  		valid = false;
 	}
 	else
 	{
 	    var iChars = "!@#$%^&*()+=-[]\\\';,./{}|\":<>?";
 		for (var i = 0; i < document.getElementById(control_id).value.length; i++) {
  		    if (iChars.indexOf(document.getElementById(control_id).value.charAt(i)) != -1) {
  			    window.alert ("Your search text has special characters. \nThese are not allowed.\nPlease remove them and try again.");
  			    valid = false;
  			    break;
  	        }
        }
     }
     return valid;
}

function submitSearchForm(section)
{
   var control_id = 'ctl00_Top_SearchText';
   if  (section ==  'hcp')
        control_id = 'ctl00_Search_SearchText'
   
    if (validateSearchForm(control_id)) {
        if (section == 'hcp') {
            window.location=window.root + 'hcp/search_results.aspx?q=' + document.getElementById(control_id).value;
        }
        else
            window.location=window.root + 'search_results.aspx?q=' + document.getElementById(control_id).value;
    }
    return false;
}

function getFlashMovieObject(movieName)
{
  if (window.document[movieName]) 
  {
      return window.document[movieName];
  }
  if (navigator.appName.indexOf("Microsoft Internet")==-1)
  {
    if (document.embeds && document.embeds[movieName])
      return document.embeds[movieName]; 
  }
  else // if (navigator.appName.indexOf("Microsoft Internet")!=-1)
  {
    return document.getElementById(movieName);
  }
}

function flashRollOverOut(flashMovie, movieClip, frame)
{
	var flashMovie=getFlashMovieObject(flashMovie);
	flashMovie.TGotoFrame(movieClip, frame);
}


