// ------------------------------------------------------------------------
// MC_STATIC.JS
// Copyright: © 1998-2006 Maintenance Connection, Inc. All rights reserved.
// ------------------------------------------------------------------------

	var UA = navigator.userAgent.toLowerCase();  

	var browsername=navigator.appName;
	
	var is_ie   = (UA.indexOf("msie") != -1);
  
	var is_major = parseInt(navigator.appVersion);
	var is_minor = parseFloat(navigator.appVersion);

	var is_ns = ((UA.indexOf('mozilla')!= -1) && ((UA.indexOf('spoofer')== -1) && (UA.indexOf('compatible')== -1)));
	var is_ns4 = (is_ns && (is_major == 4));
	  
	var is_ns62 = (is_ns && (UA.indexOf('6.')!= -1 || UA.indexOf('7.')!= -1));
	    
	var is_ie3  = (is_ie && (is_major < 4));
	var is_ie4  = (is_ie && (is_major == 4) && (UA.indexOf("msie 4.")!=-1) );
	var is_ie4up  = (is_ie  && (is_major >= 4));
	var is_ie5  = (is_ie && (is_major == 4) && (UA.indexOf("msie 5.0")!=-1) );
	var is_ie5up  = (is_ie  && !is_ie3 && !is_ie4);  
	var is_ie55 = (is_ie && (is_major == 4) && (UA.indexOf("msie 5.5")!=-1) );
	var is_ie6 = (is_ie && (is_major >= 4) && (UA.indexOf("msie 6.")!=-1) );
	var is_ie55up = (is_ie  && !is_ie3 && !is_ie4 && !is_ie5);  

	var is_mac = (UA.indexOf("mac")!=-1);	

	var is_ie6up = (!is_mac && is_ie  && !is_ie3 && !is_ie4 && !is_ie5 && !is_ie55);  
	
	//var is_ie6 = true;
	//var is_ie55up = true;
	//var is_ie6up = true;
	//var is_ie = true;

	if (is_ns && (UA.indexOf("rv:1.2")!=-1 || UA.indexOf("rv:1.1")!=-1))
	{ 
		var is_mozilla12up = true; 
	}
	else
	{ 
		var is_mozilla12up = false; 
	}			

	if(!is_ie && !is_ns62 && !is_mozilla12up)
	{
		if (is_mac)
		{
		  	//self.location.href = 'mc_notusingwindows.htm';			
		}
		else
		{	
			//self.location.href = 'mc_notusingie.htm';
		}
	}
 
	function checkcookies(url)
	{
		if (isCookieEnabled() == false)
		{
			self.location.href = 'mc_notusingcookies.htm';
		}
		else
		{		
	  		self.location.href = url;
	  	}
	}  

	function checkie(url)
	{
	  if (url.toLowerCase().indexOf('tryitout.asp') != -1)
	  {
		if (url.toLowerCase().indexOf('industry=') == -1)
		{	  
			if (url.indexOf('?') != -1)
			{
				url += '&industry='+ReadCookie('mcindustry');
			}
			else
			{
				url += '?industry='+ReadCookie('mcindustry');		
			}
		}
	  }
	  if (isCookieEnabled() == false)
	  {
			self.location.href = 'mc_notusingcookies.htm';
	  }	  
	  else
	  {
		if (is_ie6up == false)
		{
			if (is_mac)
			{
			  	//self.location.href = 'mc_notusingwindows.htm';			
  				self.location.href = url;
			  	return true;
			}
			else
			{
				if (is_ie == true)
				{
					self.location.href = 'mc_notusingie60.htm';
					return false;				
				}
				else
				{
					//self.location.href = 'mc_notusingie60.htm';
  					self.location.href = url;
  				}
			  	return true;
			}
			return false;
		}
		else
		{
			if (is_mac)
			{
			  	//self.location.href = 'mc_notusingwindows.htm';
  				self.location.href = url;
			  	return true;
			}
			else
			{
				if (isCookieEnabled() == false)
				{
					self.location.href = 'mc_notusingcookies.htm';
				}
				else
				{		
					self.location.href = url;
				}
			}
		}   
	  }
	}  

	function isCookieEnabled()
	{
	    var curCookie = 'test=y; path=/;';
	    document.cookie = curCookie;

	    var dc = document.cookie;
	    var prefix = 'test=';
	    var begin = dc.indexOf(prefix);
	    if (begin == -1)
	    {
			return false;
		}
		return true;
	}
  
  function checkieorns6(url)
  {	
    if (is_ie6up == false && !is_ns62 && !is_mozilla12up)
    {
		if (is_mac)
		{
		  	//self.location.href = 'mc_notusingwindows.htm';		
   			//self.location.href = url.replace('.htm','_mac.asp');
   			self.location.href = url;
		  	return true;
		}
		else if(!is_ie)
		{
			//self.location.href = 'mc_notusingie.htm';		
   			self.location.href = url;
		  	return true;
		}		
		else
		{    
    		self.location.href = 'mc_notusingie60.htm';
    	}
    	return false;
    }
    else
    {
		if (is_mac)
		{
		  	//self.location.href = 'mc_notusingwindows.htm';			
		}
		else
		{    
			if (isCookieEnabled() == false)
			{
				self.location.href = 'mc_notusingcookies.htm';
			}
			else
			{				
    			self.location.href = url;
    		}
    	}
    }   
  }  

  function changeindustry(s,i)
  {
	if (s == null && i == null)
	{
		return;
	}
	if (s == null)
	{
		// set dropdown with correct value
		var sel = document.getElementById('Industry');
		if (sel)
		{
			sel.value = i;
		}		
		// write cookie with correct value
		setCookie('mcindustry',i,20);							
		var url = 'mc_industry_' + i.toLowerCase() + '.htm';
	}
	else
	{		
		// write cookie with correct value
		setCookie('mcindustry',s.value,20);						
		var url = 'mc_industry.asp';  
	}
	// jump to industry page
	self.location.href = url;
  }