var agt=navigator.userAgent.toLowerCase(); 

// *** BROWSER VERSION *** 
// Note: On IE5, these return 4, so use is_ie5up to detect IE5. 
var is_major = parseInt(navigator.appVersion); 
var is_minor = parseFloat(navigator.appVersion); 

// Note: Opera and WebTV spoof Navigator.  We do strict client detection. 
// If you want to allow spoofing, take out the tests for opera and webtv. 
var is_nav  = ((agt.indexOf('mozilla')!=-1) && (agt.indexOf('spoofer')==-1) 
            && (agt.indexOf('compatible') == -1) && (agt.indexOf('opera')==-1) 
            && (agt.indexOf('webtv')==-1)); 
var is_nav2 = (is_nav && (is_major == 2)); 
var is_nav3 = (is_nav && (is_major == 3)); 
var is_nav4 = (is_nav && (is_major == 4)); 
var is_nav4up = (is_nav && (is_major >= 4)); 
var is_navonly      = (is_nav && ((agt.indexOf(";nav") != -1) || 
                      (agt.indexOf("; nav") != -1)) ); 
var is_nav5 = (is_nav && (is_major == 5));  // Netscape 6
var is_nav5up = (is_nav && (is_major >= 5)); 

var is_ie   = (agt.indexOf("msie") != -1); 
var is_ie3  = (is_ie && (is_major < 4)); 
var is_ie4  = (is_ie && (is_major == 4) && (agt.indexOf("msie 5")==-1) && (agt.indexOf("msie 6")==-1) ); 
var is_ie5  = (is_ie && (is_major == 4) && (agt.indexOf("msie 5")!=-1) && (agt.indexOf("msie 5.5")==-1) &&  (agt.indexOf("msie 6")==-1) ); 
var is_ie55 = (is_ie && (is_major == 4) && (agt.indexOf("msie 5.5")!=-1));
var is_ie6  = (is_ie && (is_major == 4) && (agt.indexOf("msie 6")!=-1) ); 

// Means that the browser is IE4 or higher
var is_ie4up  = (is_ie  && (is_major >= 4)); 
// Means that the browser is IE5 or higher
var is_ie5up  = (is_ie && !is_ie3 && !is_ie4);
// Means that the browser is IE55 or higher
var is_ie55up = (is_ie && !is_ie3 && !is_ie4 && !is_ie5);
// Means that the browser is IE6 or higher
var is_ie6up  = (is_ie && !is_ie3 && !is_ie4 && !is_ie5 && !is_ie55);

// *** PLATFORM ***
var is_win   = ( (agt.indexOf("win")!=-1) || (agt.indexOf("16bit")!=-1) );
// NOTE: On Opera 3.0, the userAgent string includes "Windows 95/NT4" on all
//        Win32, so you can't distinguish between Win95 and WinNT.
var is_win95 = ((agt.indexOf("win95")!=-1) || (agt.indexOf("windows 95")!=-1));

// is this a 16 bit compiled version?
var is_win16 = ((agt.indexOf("win16")!=-1) || 
           (agt.indexOf("16bit")!=-1) || (agt.indexOf("windows 3.1")!=-1) || 
           (agt.indexOf("windows 16-bit")!=-1) );  

var is_win31 = ((agt.indexOf("windows 3.1")!=-1) || (agt.indexOf("win16")!=-1) ||
                (agt.indexOf("windows 16-bit")!=-1));

// NOTE: Reliable detection of Win98 may not be possible. It appears that:
//       - On Nav 4.x and before you'll get plain "Windows" in userAgent.
//       - On Mercury client, the 32-bit version will return "Win98", but
//         the 16-bit version running on Win98 will still return "Win95".
var is_win98 = ((agt.indexOf("win98")!=-1) || (agt.indexOf("windows 98")!=-1));
var is_winnt = ((agt.indexOf("winnt")!=-1) || (agt.indexOf("windows nt")!=-1));
var is_win32 = (is_win95 || is_winnt || is_win98 || 
                ((is_major >= 4) && (navigator.platform == "Win32")) ||
                (agt.indexOf("win32")!=-1) || (agt.indexOf("32bit")!=-1));

function start() {
	// Do the appropriate thing depending on the browser and operating system
	if((is_ie6up) && (navigator.appMinorVersion.toLowerCase().indexOf("sp2") != -1)) {
		alert('You must use Internet Explorer 5.5 or earlier');
		location.href = "http://makeover.ivillage.com/IVillage/flashRemoting/index.jsp";
	} else if (is_ie4 && is_winnt) { //IE4 and Windows NT
		//alert('You must use Internet Explorer 5+ on Windows NT  '); 
		location.href = "http://www.substance.com/es/mom/article/0,,235826,00.html";				
	} else if (is_ie4up && is_win32) {  //IE and Windows
		if (screen.width >= 800) {
			//app = window.open("IEuk20040331/index.html?sid=" + escape(location.href), "APP", "toolbar=no, top=40, left=40, menubar=no, scrollbars=auto, systemmenu=no, height=600, width=750"); // Original height=545, width=790

			app = window.open("http://66.48.68.136/IEuk20040331/start_new.asp?sid=" + escape(location.href), "APP", "toolbar=no, top=0, left=0, menubar=no, scrollbars=auto, systemmenu=no, height=600, width=750"); // Original height=545, width=790
		} else { //Assume 640 by 480
			app = window.open("http://66.48.68.136/IEuk20040331/start_new.asp?sid=" + escape(location.href), "APP", "toolbar=no, top=0, left=0, menubar=no, scrollbars=yes, systemmenu=no, height=600, width=638"); // Original height=455, width=630
		} 		
	} else if (is_nav4) {  //Nav and any OS
		if (screen.width >= 800) {
			app = window.open("http://66.48.68.136/Netscape20020314/start_new.asp?sid="+escape(location.href),"APP","screenX=0,screenY=0,innerHeight=600,innerWidth=750"); // Original height=545, width=790 
		} else { //Assume 640 by 480
			app = window.open("http://66.48.68.136/Netscape20020314/start_new.asp?sid="+escape(location.href),"APP","screenX=0,screenY=0,innerHeight=430,innerWidth=661"); // Original height=455, width=630
		}
		/*
		// BACKUP
		if (screen.width >= 800) {
			app = window.open("http://66.48.68.136/IEuk20040331/start.asp?sid=" + escape(location.href), "APP", "toolbar=no, top=0, left=0, menubar=no, scrollbars=no, systemmenu=no, height=500, width=630"); // Original height=545, width=790
		} else { //Assume 640 by 480
			app = window.open("http://66.48.68.136/IEuk20040331/start.asp?sid=" + escape(location.href), "APP", "toolbar=no, top=0, left=0, menubar=no, scrollbars=yes, systemmenu=no, height=427, width=638"); // Original height=455, width=630
		} 		
	} else if (is_nav4) {  //Nav and any OS
		if (screen.width >= 800) {
			app = window.open("http://66.48.68.136/Netscape20020314/start.asp?sid="+escape(location.href),"APP","screenX=0,screenY=0,innerHeight=500,innerWidth=635"); // Original height=545, width=790 
		} else { //Assume 640 by 480
			app = window.open("http://66.48.68.136/Netscape20020314/start.asp?sid="+escape(location.href),"APP","screenX=0,screenY=0,innerHeight=430,innerWidth=661"); // Original height=455, width=630
		}
		*/
	} else {
		//This is best run on Nav 4.7 on Mac
		//This is best run on IE 5.5 on Win		
		//alert('If you are using a Macintosh, you must use Netscape 4.x.\nOtherwise, if you are using Windows, you must use Internet Explorer 4+ or Netscape 4.x');
		location.href = "http://www.substance.com/es/mom/article/0,,235826,00.html";		
	} 
}	