
if (window.addEventListener) window.addEventListener ("load",function(event) {openMenuState('none')},false);
	else if (window.attachEvent) window.attachEvent ("onload",function(event) {openMenuState('none')});

function openMenu(objectID, newClass){
	if(newClass != 'none'){
		try{
			if(document.getElementById(objectID).className == newClass){//open menu
				document.getElementById(objectID).className='menuClosed';
				createCookie('menuState','menuClosed',1);
	
			}
			else{//close menu
				document.getElementById(objectID).className=newClass;
				createCookie('menuState',newClass,1);
				
			}
		}catch(e){};
	}
}
function openMenuState(newClass){
	//set_styleSheet_cookie();

	if(newClass == null)newClass = GetCookie ('menuState');
	if(newClass == null)return;
	openMenu('mainNavigation', newClass);
	if(GetCookie('Site')){
		var subPath = GetCookie('Site');
		createCookie('tevaBlogSubPAth',subPath,1,'teva.com');
		
	}else{
	
		createCookie('tevaBlogSubPAth','us',1,'teva.com');
	
	}
	
}
//this is to triger a tag click events 
 function fireEvent(obj,evt){
	
	var fireOnThis = obj;
	if( document.createEvent ) {
	  var evObj = document.createEvent('MouseEvents');
	  evObj.initEvent( evt, true, false );
	  fireOnThis.dispatchEvent(evObj);
	} else if( document.createEventObject ) {
	  fireOnThis.fireEvent('on'+evt);
	}
}
		
var cookieTime = 7;
var cookieName_style_sheet = "Teva_styleSheet"
function loadCss(css_title){
	
	createCookie(cookieName_style_sheet, css_title, cookieTime, 'teva.com' );
	
	if(!GetCookie('tevaBlog')){
		document.getElementById("userstylesheet").href="/_css/T_main_sub_"+css_title+".css";
		
	}else{
	
		document.getElementById("ctl00_userstylesheet").href=GetCookie('tevaBlog')+"/_css/T_main_sub_"+css_title+".css";
	}
}

function set_styleSheet_cookie()
{

  var css_title = GetCookie( cookieName_style_sheet );

  if (css_title != null) {
    loadCss( css_title );
  }else{
	loadCss( 'one' );
  
  }
}

//This is the Cookie stuff//

// domain is optional.
function createCookie(name,value,days,domain) {
    if (days) {
	    var date = new Date();
	    date.setTime(date.getTime()+(days*24*60*60*1000));
	    var expires = "; expires="+date.toGMTString();
    }
    else var expires = "";

    if ( domain )
      document.cookie = name+"="+value+expires+"; path=/; domain="+domain;
    else
      document.cookie = name+"="+value+expires+"; path=/";


}

function eraseCookie(name) {
    createCookie(name,"",-1);
}

function GetCookie (name) {
  var arg = name + "=";
  var alen = arg.length;
  var clen = document.cookie.length;
  var i = 0;
  while (i < clen) {
    var j = i + alen;
    if (document.cookie.substring(i, j) == arg)
      return _getCookieVal (j);
    i = document.cookie.indexOf(" ", i) + 1;
    if (i == 0) break; 
  }
  return null;
}

// "Internal" function to return the decoded value of a cookie
//
function _getCookieVal (offset) {
  var endstr = document.cookie.indexOf (";", offset);
  if (endstr == -1)
    endstr = document.cookie.length;
  return unescape(document.cookie.substring(offset, endstr));
}


// function to clear out the Search Field text
//

function clear_searchBox(who)
	{
		if(who=='cs'){
			if (document.searchForm.SearchFor.value == "Product Search"){
				document.searchForm.SearchFor.value = "";
			}
		}else{
			if(document.ErrorSearchForm.ErrorSearchFor.value == "Product Search"){
				document.ErrorSearchForm.ErrorSearchFor.value = "";
			}
		}
	} 

function clear_emailBox()
	{
	if (document.aspnetForm.Footer$SearchForReg.value == " enter email address")
	document.aspnetForm.Footer$SearchForReg.value = "";
	} 


function verifySearch()
	{
		if (document.searchForm.SearchFor.value == "Product Search"){
			alert('Please enter a product or model number in the search box, then click GO.'); return false;	
		}
	return true;
	}
	
//this is the popup script function//	

	function newPopup(url, height, width) {
		popupWindow = window.open(
		url,'popUpWindow','height='+height+',width='+width+',left=0,top=0,resizable=no,scrollbars=no,toolbar=no,menubar=no,location=no,directories=no,status=no')
	}

// function for live chat help ///////////////////////////////////////
function OpenWindowSRC(url, name, width, height, scroll) {
                  popupWin = window.open(url, name, 'status=no,menubar=no,location=no,toolbar=no,scrollbars=' + scroll +',resizable=no,width=' + width +',height=' + height + ',screenX=0,screenY=0,top=0,left=0')
}

	

