var requiredVersion = 6;			
var flash2Installed = false;		
var flash3Installed = false;		
var flash4Installed = false;		
var flash5Installed = false;
var flash6Installed = false;
var flash7Installed = false;		
var maxVersion 	    = 7;					
var actualVersion   = 0;				
var hasRightVersion = false;		
var jsVersion 	    = 1.1;				
var musicStatus			= 1 ;
var isIE 	    			= (navigator.appVersion.indexOf("MSIE") != -1) ? true : false;		
var isWin 	    		= (navigator.appVersion.indexOf("Windows") != -1) ? true : false; 
var isMac 	    		= (navigator.appVersion.indexOf("Mac") != -1) ? true : false; 
var oeTags	    		= "";
var days 						= 14; // valid two weeks from now
var today 					= new Date();
var zero_date 			= new Date(0,0,0);
today.setTime(today.getTime() - zero_date.getTime());
var todays_date 		= new Date(today.getYear(),today.getMonth(),today.getDate(),0,0,0);
var expires_date 		= new Date(todays_date.getTime() + (days * 86400000));

if(isIE && isWin){ 
	document.write('<SCR' + 'IPT LANGUAGE=VBScript\> \n');
	document.write('on error resume next \n');
	document.write('flash2Installed = (IsObject(CreateObject("ShockwaveFlash.ShockwaveFlash.2"))) \n');	

	if(flash2Installed=false) {	  	
	  	flash2Installed = (IsObject(CreateObject("ShockwaveFlash.ShockwaveFlash.2")))
	}
	document.write('flash3Installed = (IsObject(CreateObject("ShockwaveFlash.ShockwaveFlash.3"))) \n');
	document.write('flash4Installed = (IsObject(CreateObject("ShockwaveFlash.ShockwaveFlash.4"))) \n');
	document.write('flash5Installed = (IsObject(CreateObject("ShockwaveFlash.ShockwaveFlash.5"))) \n');	
	document.write('flash6Installed = (IsObject(CreateObject("ShockwaveFlash.ShockwaveFlash.6"))) \n');	
	document.write('flash7Installed = (IsObject(CreateObject("ShockwaveFlash.ShockwaveFlash.7"))) \n');	
	document.write('</SCR' + 'IPT\> \n'); 
}

detectFlash();		
getCookieValue();

	if(hasRightVersion) {	
			   // var URLForFile = "http://65.36.251.73/flash";
			   var URLForFile = "http://192.168.0.5:5003/nsn-momameli/flash";
				var flashFileName;
			
					if (location.href.indexOf("/content") == -1) 
						flashFileName = "/momameli_splash.swf"; 
					else
						flashFileName = "/main.swf";

var flashFile = URLForFile + flashFileName +"?soundStatus="+musicStatus;

		
		
		
		flashshowing  = true;
		oeTags    =  '<OBJECT CLASSID="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"'
		  	       	   + 'WIDTH="56" HEIGHT="34"'
				    			 + 'CODEBASE="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab">'
  		      			 + '<PARAM NAME="MOVIE" VALUE="'+flashFile+'">'
									 + '<PARAM NAME="PLAY" VALUE="true">'
									 + '<PARAM NAME="wmode" value="transparent">'
									 + '<PARAM NAME="LOOP" VALUE="false">'
									 + '<PARAM NAME="QUALITY" VALUE="high">'
									 + '<PARAM NAME="MENU" VALUE="false">'
									 + '<EMBED SRC="'+flashFile+'"'
									 + 'WIDTH="56" HEIGHT="34"'
									 + 'PLAY="true"'
									 + 'LOOP="false" wmode="transparent"'
 									 + 'QUALITY="high"'
									 + 'MENU="false"'
									 + 'TYPE="application/x-shockwave-flash"'
  								 + 'PLUGINSPAGE="http://www.macromedia.com/shockwave/download/index.cgi?P1_Prod_Version=ShockwaveFlash">'
									 + '</EMBED>'
									 + '</OBJECT>';
	} 



function detectFlash(){	

	if (navigator.plugins){										
	
		if (navigator.plugins["Shockwave Flash 2.0"] || navigator.plugins["Shockwave Flash"]) {		
				var isVersion2 = navigator.plugins["Shockwave Flash 2.0"] ? " 2.0" : "";
				var flashDescription = navigator.plugins["Shockwave Flash" + isVersion2].description;
				var flashVersion = parseInt(flashDescription.charAt(flashDescription.indexOf(".") - 1));

				flash2Installed = flashVersion == 2;				
				flash3Installed = flashVersion == 3;
				flash4Installed = flashVersion == 4;
				flash5Installed = flashVersion == 5;
				flash6Installed = flashVersion == 6;
				flash7Installed = flashVersion == 7;
				
			}
	}
	
	for (var i = 2; i <= maxVersion; i++) {	
		if (eval("flash" + i + "Installed") == true) 
		actualVersion = i;
	}	
	
	if(navigator.userAgent.indexOf("WebTV") != -1) 
		actualVersion = 2;
			
	if (actualVersion >= requiredVersion) { 		
			hasRightVersion = true;
	}
	else if(isMac && !isIE){
		hasRightVersion = true;
	}
}




function getCookieValue() {

	//if (isCookieEnabled()) {
		musicStatus = Get_Cookie('musicStatus');

		if (musicStatus == null)
			musicStatus=1;
	//}
	return musicStatus;
}

function Get_Cookie(name) {
    var start = document.cookie.indexOf(name+"=");
    var len = start+name.length+1;
    if ((!start) && (name != document.cookie.substring(0,name.length))) return null;
    if (start == -1) return null;
    var end = document.cookie.indexOf(";",len);
    if (end == -1) end = document.cookie.length;
    return unescape(document.cookie.substring(len,end));

}

function Set_Cookie(name,value,expires,path,domain,secure) {
if(isIE) {

    document.cookie = name + "=" +escape(value) +
        ( (expires) ? ";expires=" + expires.toGMTString() : "") +
        ( (path) ? ";path=" + path : "") + 
        ( (domain) ? ";domain=" + domain : "") +
        ( (secure) ? ";secure" : "");
}
else{
document.cookie = name + "=" + escape(value) + ((expires == null) ? "" : "; expires=" + expires.toGMTString());

}
}

function Delete_Cookie(name,path,domain) {
    if (Get_Cookie(name)) document.cookie = name + "=" +
        ( (path) ? ";path=" + path : "") +
        ( (domain) ? ";domain=" + domain : "") +
        ";expires=Thu, 01-Jan-1970 00:00:01 GMT";
}


function isCookieEnabled() {
   if (document.all) return navigator.cookieEnabled;
   Set_Cookie('testcookie',today.getTime());
   var tc = Get_Cookie('testcookie');
   Delete_Cookie('testcookie');
   return (tc == today.getTime());
}

function setSound(value) {
//	if(isCookieEnabled())
		Set_Cookie('musicStatus',value,expires_date,'/');
}


