var nm=navigator.appName+navigator.appVersion;
var ap=navigator.userAgent;
var browserOK = false;

// Globals
// Major version of Flash required
var requiredMajorVersion = 8;
// Minor version of Flash required
var requiredMinorVersion = 0;
// Revision of Flash required
var requiredRevision = 0;
// the version of javascript supported
var jsVersion = 1.0;

if( (nm.indexOf("Netscape5")!=-1) )
	browserOK = true;
else if( document.all != null )	
	browserOK = true;

if( browserOK ) {
   var pics = new Array();
   var pics2 = new Array();
   var pics3 = new Array();
}
else
   document.location="browser.php";
   
/******** Form Email Validation ***********/
function m_sfcon (u) {
pre = "mail";
url = pre + "to:" + u;
document.location.href = url + "@natureoftheflesh.com";
}
function validate_email( theControl )
{
    if ( theControl.value == "" || theControl.value.length <= 0 )
    {
		alert("Your email address must be filled in correctly. Please" + " check the prefix and '@' sign.");
		theControl.focus();
        return false;
    }
    var reEmail = /^.+\@.+\..+$/
    var holderValue;
    var thisValue = theControl.value;
    // Check for e-mail addresses from ISPs and other sources that have been consistently
    // entered incorrectly.  If detected, correct the situation.
    if( (thisValue.substring(thisValue.length - 4, thisValue.length).toLowerCase()) == '@aol' ||
        (thisValue.substring(thisValue.length - 4, thisValue.length).toLowerCase()) == '@msn' ||
        (thisValue.substring(thisValue.length - 6, thisValue.length).toLowerCase()) == '@yahoo' ||
        (thisValue.substring(thisValue.length - 6, thisValue.length).toLowerCase()) == '@lycos' ||
        (thisValue.substring(thisValue.length - 7, thisValue.length).toLowerCase()) == '@excite' ||
        (thisValue.substring(thisValue.length - 10, thisValue.length).toLowerCase()) == '@altavista' ||
        (thisValue.substring(thisValue.length - 11, thisValue.length).toLowerCase()) == '@compuserve' ||
        (thisValue.substring(thisValue.length - 8, thisValue.length).toLowerCase()) == '@prodigy' ||
        (thisValue.substring(thisValue.length - 8, thisValue.length).toLowerCase()) == '@hotmail' ||
        (thisValue.substring(thisValue.length - 9, thisValue.length).toLowerCase()) == '@netscape' )
	{
		holderValue = thisValue.concat('.com');
		thisValue = holderValue;
		theControl.value = thisValue;
	}
    if( (thisValue.substring(thisValue.length - 5, thisValue.length).toLowerCase()) == '@home' )
	{
		holderValue = thisValue.concat('.net');
		thisValue = holderValue;
		theControl.value = thisValue;
	}
    // Now check the actual value of the e-mail address for validity.
    var flagFirstCheck = (theControl.value.length < 6) ||
						 (thisValue.indexOf('@') == -1) ||
						 (thisValue.indexOf('.') == -1) ||
						 (thisValue.indexOf('@',(thisValue.indexOf('@')+1)) != -1) ||
						 ((thisValue.indexOf('.')+1) == thisValue.length) ||
						 ((thisValue.indexOf('@')+1) == thisValue.length)
	var flagSecondCheck = reEmail.test(thisValue)
    if ( flagFirstCheck || !flagSecondCheck )
    {
		alert("Your email address seems to be incorrect. Please" + " check the prefix and '@' sign.");
		theControl.focus();
        return false;
    }
    else
        return true;
}
/**************  Preload 2 ***************/

var objCount2 = 0; // number of (changing) images on web-page
function preload( name, first, second, third ) 
{
	if( browserOK ) 
	{
		pics2[objCount2] = new Array(4);
		pics2[objCount2][0] = new Image();
		pics2[objCount2][0].src = first;
		pics2[objCount2][1] = new Image();
		pics2[objCount2][1].src = second;
		pics2[objCount2][2] = name;
		if( third != null )
		{
			pics2[objCount2][3] = new Image();
			pics2[objCount2][3].src = third;
		}
		objCount2++;
	}
}

/**************  Preload 2 ***************/

var objCount3 = 0; // number of (changing) images on web-page
function preload3( name, theimage ) 
{
	if( browserOK ) 
	{
		pics3[objCount3] = new Array(2);
		pics3[objCount3][0] = new Image();
		pics3[objCount3][0].src = theimage;
		pics3[objCount3][1] = name;
		objCount3++;
	}
}

/***************** ON ******************/

function on_orig( name )
{
	if( browserOK ) 
	{
		for( i = 0; i < objCount2; i++ ) 
		{
			if( document.images[pics2[i][2]] != null )
			{ 
				if( name != pics2[i][2] ) 
				{ 
					if( pics2[i][0].complete )
						document.images[pics2[i][2]].src = pics2[i][0].src;
				} 
				else // show the second image because cursor moves across this image
				{
					if (pics2[i][1].complete)
						document.images[pics2[i][2]].src = pics2[i][1].src;
				}  
			}
		}
	}
}

/***************** ON 3 images ******************/

function on3_orig( name )
{
	if( browserOK ) 
	{
		for( i = 0; i < objCount2; i++ ) 
		{
			if( document.images[pics2[i][2]] != null )
			{ 
				if( name != pics2[i][2] ) 
				{ 
					if( pics2[i][0].complete )
						document.images[pics2[i][2]].src = pics2[i][0].src;
				} 
				else // show the second image because cursor moves across this image
				{
					if (pics2[i][1].complete)
						document.images[pics2[i][2]].src = pics2[i][3].src;
				}  
			}
		}
	}
}
/***************** OFF ******************/

function off_orig()
{
   if( browserOK ) 
   {
      for( i = 0; i < objCount2; i++ ) // set back all pictures
      {
         if( document.images[pics2[i][2]] != null )
         {
            if( pics2[i][0].complete )
               document.images[pics2[i][2]].src = pics2[i][0].src;
         }
      }
   }
}
/**************  Preload  ***************/

var objCount = 0; // number of (changing) images on web-page
function preloadMenu( name, menu_text_off, menu_text_on, preview_top_on, preview_main_on ) 
{
	if( browserOK ) 
	{
		pics[objCount] = new Array(5);
		pics[objCount][0] = new Image();
		pics[objCount][0].src = menu_text_off;
		pics[objCount][1] = new Image();
		pics[objCount][1].src = menu_text_on;		
		pics[objCount][2] = new Image();
		pics[objCount][2].src = preview_top_on;
		pics[objCount][3] = new Image();
		pics[objCount][3].src = preview_main_on;
		
		pics[objCount][4] = name;
		objCount++;
	}
}

/***************** ON ******************/

function on( name )
{
	if( browserOK ) 
	{
		for( i = 0; i < objCount; i++ ) 
		{
			if( document.images[pics[i][4]] != null )
			{ 
				if( name != pics[i][4] ) 
				{ 
					if( pics[i][0].complete )
						document.images[pics[i][4]].src = pics[i][0].src;					
				} 
				else // show the second image because cursor moves across this image
				{
					if (pics[i][3].complete)
						document.images[pics[i][4]].src = pics[i][1].src;
						if( name.indexOf("_i2") == -1 )
						{
							document.images['preview_top'].src = pics[i][2].src;
							document.images['preview_main'].src = pics[i][3].src;
						}
						else
						{
							document.images['preview_top_i2'].src = pics[i][2].src;
							document.images['preview_main_i2'].src = pics[i][3].src;						
						}					
				}  
			}
		}
	}
}

/***************** OFF ******************/

function off()
{
   if( browserOK ) 
   {
      for( i = 0; i < objCount; i++ ) // set back all pictures
      {
         if( document.images[pics[i][4]] != null )
         {
            if( pics[i][0].complete )
            	document.images[pics[i][4]].src = pics[i][0].src;
				if( pics[i][4].indexOf("_i2") == -1 )
				{
					document.images['preview_top'].src = "images/preview_top_off.jpg";
					document.images['preview_main'].src = "images/preview_main_off.jpg";
				}
				else
				{
					if(document.URL.indexOf("director.php") >= 0 )
					{						
						document.images['preview_top_i2'].src = "images/preview_top_director_i2.jpg";
						document.images['preview_main_i2'].src = "images/preview_main_director_i2.jpg";	
					}	
					else if(document.URL.indexOf("cast.php") >= 0 )
					{						
						document.images['preview_top_i2'].src = "images/preview_top_cast_i2.jpg";
						document.images['preview_main_i2'].src = "images/preview_main_cast_i2.jpg";	
					}	
					else if(document.URL.indexOf("crew.php") >= 0 )
					{						
						document.images['preview_top_i2'].src = "images/preview_top_crew_i2.jpg";
						document.images['preview_main_i2'].src = "images/preview_main_crew_i2.jpg";	
					}															
					else if(document.URL.indexOf("trailer.php") >= 0 )
					{						
						document.images['preview_top_i2'].src = "images/preview_top_trailer_i2.jpg";
						document.images['preview_main_i2'].src = "images/preview_main_trailer_i2.jpg";	
					}	
					else if( (document.URL.indexOf("outtakes.php") >= 0)  || (document.URL.indexOf("photoshow.php") >= 0) )
					{						
						document.images['preview_top_i2'].src = "images/preview_top_outtakes_i2.jpg";
						document.images['preview_main_i2'].src = "images/preview_main_outtakes_i2.jpg";	
					}
					else if( (document.URL.indexOf("dir_notes.php") >= 0) || (document.URL.indexOf("tell-tale_heart.php") >= 0) || (document.URL.indexOf("the_black_cat.php") >= 0) )
					{						
						document.images['preview_top_i2'].src = "images/preview_top_dir_notes_i2.jpg";
						document.images['preview_main_i2'].src = "images/preview_main_dir_notes_i2.jpg";	
					}	
					else if(document.URL.indexOf("prod_company.php") >= 0 )
					{						
						document.images['preview_top_i2'].src = "images/preview_top_prod_company_i2.jpg";
						document.images['preview_main_i2'].src = "images/preview_main_prod_company_i2.jpg";	
					}
					else if(document.URL.indexOf("links.php") >= 0 )
					{						
						document.images['preview_top_i2'].src = "images/preview_top_links_i2.jpg";
						document.images['preview_main_i2'].src = "images/preview_main_links_i2.jpg";	
					}																							
					else if(document.URL.indexOf("mainpage.php") != -1 )
					{
						document.images['preview_top_i2'].src = "images/preview_top_off_i2.jpg";
						document.images['preview_main_i2'].src = "images/preview_main_off_i2.jpg";					
					}		
				}
         }
      }
   }
}

/*************** Cookies Enabled *************/

function cookies_enabled()
{
   document.cookie = "Enabled=true";
   var cookieValid = document.cookie;
   if (cookieValid.indexOf("Enabled=true") != -1)
      return true;
   else
      return false;
}

/********** Check Cookies ***************/

if( !cookies_enabled() ) 
   alert("Please enable session cookies in your internet browser security setting.\nYou may need to resart your browser to insure the new settings have taken effect.");



