var _hostName = top.location.hostname;
var _urlyearend = "http://www.nyse.com/about/listed/yearEnd.js";
document.write('<scr'+'ipt LANGUAGE=JavaScript src=' + _urlyearend + '>');
document.write('</scr'+'ipt>');

function BrowserCheck() {
	var b = navigator.appName
	if (b=="Netscape") this.b = "ns"
	else if (b=="Microsoft Internet Explorer") this.b = "ie"
	else this.b = b
	this.version = navigator.appVersion
	this.v = parseInt(this.version)
	this.ns = (this.b=="ns" && this.v>=4)
	this.ns4 = (this.b=="ns" && this.v==4)
	this.ns5 = (this.b=="ns" && this.v==5)
	this.ie = (this.b=="ie" && this.v>=5)
	this.ie4 = (this.version.indexOf('MSIE 4')>0)
	this.ie5 = (this.version.indexOf('MSIE 5')>0)
	this.min = (this.ns||this.ie)
}

//window.name="NYSE";
/*var g_plugin = 0;
if (navigator.mimeTypes && navigator.mimeTypes["application/x-shockwave-flash"] && navigator.mimeTypes["application/x-shockwave-flash"].enabledPlugin) {

	var version_check = (navigator.mimeTypes && navigator.mimeTypes["application/x-shockwave-flash"] ? navigator.mimeTypes["application/x-shockwave-flash"].enabledPlugin : 0); 
	var flash_ver = parseInt(version_check.description.substring(version_check.description.indexOf(".")-1))

	if (navigator.plugins && navigator.plugins["Shockwave Flash"] && flash_ver > 4 )
		g_plugin = 1;
}
else if (navigator.userAgent && navigator.userAgent.indexOf("MSIE")>=0	&& (navigator.userAgent.indexOf("Windows 95")>=0 || navigator.userAgent.indexOf("Windows 98")>=0 	|| navigator.userAgent.indexOf("Windows NT")>=0)) {
		document.write('<SCRIPT LANGUAGE=VBScript> \n');
		document.write('on error resume next \n');
		//document.write('g_plugin = ( IsObject(CreateObject("ShockwaveFlash.ShockwaveFlash.3")))\n');
		//document.write('if ( g_plugin <= 0 ) then g_plugin = ( IsObject(CreateObject("ShockwaveFlash.ShockwaveFlash.4")))\n');
		document.write('if ( g_plugin <= 0 ) then g_plugin = ( IsObject(CreateObject("ShockwaveFlash.ShockwaveFlash.5")))\n');
		document.write('</SCRI');
		document.write('PT> \n');
}
var agt = navigator.userAgent.toLowerCase();
var is_nav  = ((agt.indexOf('mozilla')!=-1) && (agt.indexOf('spoofer')==-1)
                && (agt.indexOf('compatible') == -1) && (agt.indexOf('opera')==-1)
                && (agt.indexOf('webtv')==-1) && (agt.indexOf('hotjava')==-1));
var verNum = parseFloat(navigator.appVersion);
if (!is_nav && agt.indexOf("msie 5") < 0 && agt.indexOf('mac') > -1) {
	g_plugin = 0;
}

is = new BrowserCheck()
if (is.ie4 || is.ns4) {
g_plugin=0;
}

if (g_plugin==0) {
	document.location="../index_noflash.html";
}*/

var flashVersion = 0;
var flashVersion_DONTKNOW = -1;
var dontKnow = false;
var flashcookie = false;

function getFlashVersion() {
	var latestFlashVersion = 12;
	var agent = navigator.userAgent.toLowerCase(); 

	if (agent.indexOf("mozilla/3") != -1 && agent.indexOf("msie") == -1) {
		flashVersion = 0;
	}

	if (navigator.plugins != null && navigator.plugins.length > 0) {
		var flashPlugin = navigator.plugins['Shockwave Flash'];
		if (typeof flashPlugin == 'object') { 
			for (var coun = latestFlashVersion; coun >= 3; coun--) {
            if (flashPlugin.description.indexOf(coun + '.') != -1) {
               flashVersion = coun;
               break;
            }
         }
		}
	}

	else if (agent.indexOf("msie") != -1 && parseInt(navigator.appVersion) >= 4 && agent.indexOf("win")!=-1 && agent.indexOf("16bit")==-1) {
	   var doc = '<scr' + 'ipt language="VBScript"\> \n';
      doc += 'On Error Resume Next \n';
      doc += 'Dim obFlash \n';
      doc += 'For coun = ' + latestFlashVersion + ' To 3 Step -1 \n';
      doc += '   Set obFlash = CreateObject("ShockwaveFlash.ShockwaveFlash." & coun) \n';
      doc += '   If IsObject(obFlash) Then \n';
      doc += '      flashVersion = coun \n';
      doc += '      Exit For \n';
      doc += '   End If \n';
      doc += 'Next \n';
      doc += '</scr' + 'ipt\> \n';
      document.write(doc);
   }
		
	else if (agent.indexOf("webtv/2.5") != -1) {
			flashVersion = 3;
	}

	else if (agent.indexOf("webtv") != -1) flashVersion = 2;

	else {
		flashVersion = flashVersion_DONTKNOW;
	}

	return flashVersion;
}

function createcookie() {
	var cookieStart = document.cookie.indexOf('isflash');

	if (cookieStart != -1) {
		var cookieEnd = document.cookie.indexOf(';', cookieStart);
		if (cookieEnd == -1) cookieEnd = document.cookie.length; {
			flashVersion = document.cookie.substring(cookieStart + 8, cookieEnd);
			flashcookie = true;
		}
	}
	else {
		flashVersion = getFlashVersion();
		document.cookie = 'isflash=' + flashVersion;
	}
}

createcookie();

if (flashVersion == flashVersion_DONTKNOW) {
	flashVersion = 0;
	dontKnow = true;
}

function checkflash() {
	if(flashVersion<6 && flashcookie==false) {
		flash("http://www.nyse.com/get_flash.html");
	}
}

checkflash();

function clearcookie() {
	name = document.cookie;
	var expire = new Date();
	expire.setTime(expire.getTime() - 1000);
	document.cookie = name + "=" + "" + "; expires=" + expire.toUTCString();
}

function verifyflash() {
	clearcookie();
	location.reload();
}

var helpWindow;
function help(helpURL) {
	if (_hostName.indexOf("secfilings.")!=-1)
		helpURL = "http://www.nyse.com" + helpURL;
	var helpWindowAttributes = "width=430,height=430,scrollbars=yes,directories=no,status=no,location=no,menubar=no,personalbar=no,resizable=yes,titlebar=no,toolbar=no";
	if (helpWindow && !helpWindow.closed) {
		helpWindow.document.location.href = helpURL;
	} else {
		helpWindow = window.open(helpURL, "help", helpWindowAttributes);
	}
	helpWindow.focus();
}

var symbolWindow;
function symbol(symbolURL) {
	if (_hostName.indexOf("secfilings.")!=-1) {
		symbolURL = "http://www.nyse.com" + symbolURL;
		window.name="";
	}
	var symbolWindowAttributes = "width=430,height=430,scrollbars=1,directories=no,status=no,location=no,menubar=no,personalbar=no,resizable=no,titlebar=no,toolbar=no";
	if (symbolWindow && !symbolWindow.closed) {
		symbolWindow.document.location.href = symbolURL;
	} else {
		symbolWindow = window.open(symbolURL, "symbol", symbolWindowAttributes);
	}
	if (_hostName.indexOf("secfilings.")!=-1) {
		symbolWindow.opener = null;
	}

	symbolWindow.focus();
}

var faqWindow;
function faq(faqURL) {
	
	var faqWindowAttributes = "width=446, height=430, scrollbars=yes, directories=no, status=no, location=no, menubar=no, personalbar=no, resizable=yes, titlebar=no, toolbar=no";
	if (faqWindow && !faqWindow.closed) {
		faqWindow.document.location.href = faqURL;
	} else {
		faqWindow = window.open(faqURL, "faq", faqWindowAttributes);
	}
	faqWindow.focus();
}

var flashWindow;
function flash(flashURL) {
	
	var flashWindowAttributes = "width=430, height=220, scrollbars=no, directories=no, status=no, location=no, menubar=no, personalbar=no, resizable=no, titlebar=no, toolbar=no" + " top= " + ((screen.height/2)-110) + " left= " + ((screen.width/2)-215);
	if (flashWindow && !flashWindow.closed) {
		flashWindow.document.location.href = flashURL;
	} else {
		flashWindow = window.open(flashURL, "flash", flashWindowAttributes);
	}
	flashWindow.focus();
}

var lcFactSheetWindow;
function lcFactSheet(lcFactSheetURL) {
	var lcFSWindowAttributes= "width=637,height=600,scrollbars=yes,directories=no,status=no,location=no,menubar=no,personalbar=no,resizable=yes,titlebar=no,toolbar=no";
	if (lcFactSheetWindow && !lcFactSheetWindow.closed) {
		lcFactSheetWindow.document.location.href = lcFactSheetURL;
	} else {
		lcFactSheetWindow = window.open(lcFactSheetURL, "test", lcFSWindowAttributes);
	}
	lcFactSheetWindow.focus();
}


/* duplicate function found. commented below code.
var symbolWindow;
function symbol(symbolURL) {
	
	var symbolWindowAttributes = "width=430,height=430,scrollbars=1,directories=no,status=yes,location=no,menubar=no,personalbar=no,resizable=no,titlebar=no,toolbar=no";
	if (symbolWindow && !symbolWindow.closed) {
		symbolWindow.document.location.href = symbolURL;
	} else {
		symbolWindow = window.open(symbolURL, "symbol", symbolWindowAttributes);
	}
	symbolWindow.focus();
}*/


window.onError = null;
var tempParentWindow = null;
function writeToParentMain(main)
{
	tempParentWindow = top.opener.top;
	if(main.indexOf("www.") != -1) {
		var outURL = parseQuery(main,"displayPage");
		open_window(outURL,"extsitename");
	}
	else {
	       if (tempParentWindow != null) 
			tempParentWindow.window.location.href = main;
		else 
			open_window(outURL,"NYSE");
	
	}
}

function open_window(url, name) {
        popup = window.open(url, name);
}

// Parses a query string 'queryString' for the variable 'queryName'
// and returns the value associated with that name.
function parseQuery (queryString, queryName) {
	startIndex = queryString.indexOf(queryName);
	if (startIndex == -1) {
		return false;
	}
	startIndex = queryString.indexOf("=", startIndex) + 1;
	endIndex = queryString.length;
	theVal = queryString.substring(startIndex, endIndex);
	theVal = unescape(theVal);
	return (theVal);	
}



// Returns the entire query string passed to the current page.
function getQueryString(){ 
	zquery = parent.location.search; 
	zquery = zquery.substring(1,zquery.length); 
	ananchor = parent.location.hash;
	if (ananchor != "") {
		zquery = zquery + ananchor;
	}
	return (zquery); 
}

var queryString = getQueryString();
var parseString = parseQuery(queryString,"c");
try
{
	if(parseString == "210156" || content_lang == "fr") {
		content_lang = "fr";
	}
	else if (content_lang == "md")
	{
		content_lang = "md";
	}else {
		content_lang = "en";
	}
}
catch (exception)
{
	content_lang = "en";
}


//surfaid flash player version
function surfaid_fp() {
	var surfaid_fp_msg = "";
	if(flashVersion >= 6)
		surfaid_fp_msg = "fp" + flashVersion;
	else if(flashVersion > 0 && flashVersion < 6)
		surfaid_fp_msg = "fpother";
	else 
		surfaid_fp_msg = "fpnone";

	return surfaid_fp_msg;
}

