function MM_showHideLayers() { //v6.0
  var i,p,v,obj,args=MM_showHideLayers.arguments;
  for (i=0; i<(args.length-2); i+=3) if ((obj=MM_findObj(args[i]))!=null) { v=args[i+2];
    if (obj.style) { obj=obj.style; v=(v=='show')?'visible':(v=='hide')?'hidden':v; }
    obj.visibility=v; }
}
function showISI() {
	MM_showHideLayers('divFlash','','show')
 	window.document.aravaScroller_Consumer.Play();
}
function MM_swapImage() 
{ 	//v3.0
  	var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
   	if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}

function MM_swapImgRestore() 
{ 	//v3.0
  	var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}

function MM_preloadImages() 
{ 	//v3.0
 	var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
   	var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
   	if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}

function MM_findObj(n, d) 
{	//v4.0
  	var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  	if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  	for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
  	if(!x && document.getElementById) x=document.getElementById(n); return x;
}
function openWin( windowURL, windowName, windowFeatures) {
     window.open( windowURL, windowName, windowFeatures ) ;
}

function closeWin( windowURL ) {
	window.close( windowURL );
}
function openPIWindow() {
	openWin(window.root+'pregnancy_isi.aspx','pi_window','toolbar=no,menubar=no,scrollbars=yes,status=yes,width=580,height=400');
}

function openPIConsumerWindow() {
	openWin(window.root+'con_isi.aspx','pi_window','toolbar=no,menubar=no,scrollbars=yes,status=yes,width=580,height=400');
}

function openImpWindow() {
	openWin('http://products.sanofi-aventis.us/arava/arava.html','pi','width=700,height=450,toolbar=0,location=0,directories=0,status=0,menuBar=1,scrollBars=1,resizable=1');
}
function openMovieWindow(movie) {
	openWin(window.root+'hcp_movie.aspx?movie='+movie,'TextSizer','toolbar=yes,menubar=yes,scrollbars=yes,status=no,width=600,height=500,top=(screen.availHeight-600)/2, left=(screen.availWidth-500)/2');
}

function openSlidesWindow() {
	openWin('/professional/about_arava/slides/ppt.do','TextSizer','toolbar=yes,menubar=yes,scrollbars=yes,status=no,width=600,height=500,top=(screen.availHeight-600)/2, left=(screen.availWidth-500)/2');
}
function init(){
}

function destroy(){
	openPIWindow(null);
		
}

function openWebPages(destination){
	openPIWindow();
	openWin(destination, 'off_site','resizable=yes,location=yes,toolbar=yes,menubar=yes,scrollbars=yes,status=yes,width=600,height=550,top=(screen.availHeight-600)/2, left=(screen.availWidth-600)/2');
}

function openWebPages2(destination){
	openPIConsumerWindow();
	openWin(destination, 'off_site','resizable=yes,location=yes,toolbar=yes,menubar=yes,scrollbars=yes,status=yes,width=600,height=550,top=(screen.availHeight-600)/2, left=(screen.availWidth-600)/2');
}

function checkBrowser(source) {
	var top = self.screenTop;
	if (top > 9000)
	// window closed
	{ 
		if (source == "Patient")
			openPIConsumerWindow();
		else
			openPIWindow();
	}
	else
	{
	// window refreshed
	}
}

function openPhysicianMessageWindow(message) {
	openWin(message,'Physician_Message','toolbar=no,menubar=no,scrollbars=no,status=yes,width=450,height=300');
}


//Storing images in cache for faster retrieval */
ActiveImage= new Image()
ActiveImage.src = 'URL(/http/images/left_btn_active.gif)';
InactiveImage= new Image()
InactiveImage.src = 'URL(/http/images/left_btn_inactive.gif)';

//For hovering to work in netscape
function changeBg(event, name) {
     var browser = navigator.appName.substring(0,8);
	 if (browser == "Netscape"){
 		if (event == "out") {
  			name.style.backgroundImage = 'url(/http/images/left_btn_inactive.gif)';
 		}
 		if (event == "over") {
  			name.style.backgroundImage = 'url(/http/images/left_btn_active.gif)';
 		}
 	}
}

function confirmHcp()
{ 
	var bln = confirm('This information is intended for U.S. Healthcare Professionals.\nIf you are a Healthcare Professional, click ok to continue.');
	if (bln)
	{
		window.location.href=window.root+'hcp/default.aspx';
	}
}

function confirmConsumer()
{ 
	var bln = confirm('This information is intended only for U.S. residents.');
	if (bln)
	{
		window.location.href=window.root+'default.aspx';
	}
}

function writeCookie(name, value, hours) {
  var expire = "";
  if(hours != null)
  {
    expire = new Date((new Date()).getTime() + hours * 3600000);
    expire = "; expires=" + expire.toGMTString();
  }
  document.cookie = name + "=" + escape(value) + expire; }

function readCookie(name)
{
  var cookieValue = "";
  var search = name + "=";
  if(document.cookie.length > 0)
  { 
    offset = document.cookie.indexOf(search);
    if (offset != -1)
    { 
      offset += search.length;
      end = document.cookie.indexOf(";", offset);
      if (end == -1) end = document.cookie.length;
      cookieValue = unescape(document.cookie.substring(offset, end))
    }
  }
  return cookieValue;
}

// Newly added code

function submitSearchForm()
{
 if (validateSearchForm()) {
    window.location=window.root+'searchResults.aspx?q='+document.getElementById("ctl00_search1_searchText").value;
   }
    return false;
}
function submitSearchFormHcp()
{
 if (validateSearchForm()) {
    window.location=window.root+'hcp_searchResults.aspx?q='+document.getElementById("ctl00_search1_searchText").value;
   }
    return false;
}

function validateSearchForm()
{
    var valid = true;
    if (document.getElementById('ctl00_search1_searchText').value == "Search" || 
    document.getElementById('ctl00_search1_searchText').value.length == 0 ) {
 	    window.alert ("Please enter a search text.");
  		valid = false;
 	}
 	else
 	{
 	    var iChars = "!@#$%^&*()+=-[]\\\';,./{}|\":<>?";
 		for (var i = 0; i < document.getElementById('ctl00_search1_searchText').value.length; i++) {
  		    if (iChars.indexOf(document.getElementById('ctl00_search1_searchText').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 doClear(theText)
{ 
    if (theText.value == theText.defaultValue) 
    {
        theText.value = "";
    }
} 