	function SWFObject(swfname, width, height){
		var temp1 = new Object();
		temp1.swfname = swfname;
		temp1.width = width;
		temp1.height = height;
		return temp1;
	}

	function NoFlashImg(bimg){
		var temp2 = new Object();
		temp2.img = bimg;
		return temp2;
	}

	function LoginPopup(phref,pleft,ptop,pwidth,pheight){
		var temp3 = new Object();
		temp3.href = phref;
		temp3.left = pleft;
		temp3.top = ptop;
		temp3.width = pwidth;
		temp3.height = pheight;
		return temp3;
	}

   function LiteNoFlashImg(bimg){
		var temp2 = new Object();
		temp2.img = bimg;
		return temp2;
   }


	var obj = new Object();
    
    obj['MSSB'] = new SWFObject("/swfs/homeFeature_unauth_mssb.swf","633","233");
    obj['CPWM'] =  new SWFObject("/swfs/homeFeature_unauth_cpwm.swf","633","233");
    obj['CPB'] = new SWFObject("/swfs/homeFeature_unauth_cprb.swf","633","233");
    obj['Citi'] = new SWFObject("/swfs/homeFeature_unauth_myfi.swf","633","233");
  

	var objNoFlash = new Object();
	
	objNoFlash['MSSB'] = new NoFlashImg("/images/FlashImages/homeFeature_unauth_mssb.gif");
	objNoFlash['CPWM'] = new NoFlashImg("/images/FlashImages/homeFeature_unauth_cpwm.jpg");
	objNoFlash['CPB'] = new NoFlashImg("/images/FlashImages/homeFeature_unauth_cprb.jpg");
	objNoFlash['Citi'] = new NoFlashImg("/images/FlashImages/homeFeature_unauth_myfi.jpg");
  
  
	var popupFeatures = new Object();
	
	popupFeatures['MSSB'] = new LoginPopup('http://www.morganstanleyindividual.com/ceo-ceo/',40,40,720,540);
	popupFeatures['CPWM'] = new LoginPopup('http://get.adobe.com/flashplayer/',40,40,720, 540);
	popupFeatures['CPB'] = new LoginPopup('http://get.adobe.com/flashplayer/',40,40,720,540);
	popupFeatures['Citi'] = new LoginPopup('http://get.adobe.com/flashplayer/',40,40,720,540);
    
	var liteObjNoFlash = new Object();

	liteObjNoFlash['MSSB'] = new LiteNoFlashImg("/images/homepage/liteLogonFeature_mssb.gif");
	liteObjNoFlash['CPWM'] = new LiteNoFlashImg("/images/homepage/liteLogonFeature_cpwm.jpg");
	liteObjNoFlash['CPB'] = new LiteNoFlashImg("/images/homepage/liteLogonFeature_cprb.jpg");
	liteObjNoFlash['Citi'] = new LiteNoFlashImg("/images/homepage/liteLogonFeature_myfi.jpg");

	var LitepopupFeatures = new Object();
	
	LitepopupFeatures['MSSB'] = new LoginPopup('http://www.morganstanleyindividual.com/ceo-ceo/',40,40,720,540);
	LitepopupFeatures['CPWM'] = new LoginPopup('https://www.smithbarney.com/research/investment_ideas/',40,40,720, 540);
	LitepopupFeatures['CPB'] = new LoginPopup('https://www.smithbarney.com/research/investment_ideas/',40,40,720, 540);
	LitepopupFeatures['Citi'] = new LoginPopup('https://www.smithbarney.com/research/investment_ideas/',40,40,720, 540);
    
	
	function getBrand(){
		var aBrand;
		var temp1 = getcookie('BRAND_CTX');
		
		if(temp1 != 'empty'){
			var temp2 = temp1.indexOf("|");
        	aBrand= temp1.substring(1,parseInt(temp2));
            if(aBrand== "null")
            	aBrand='MSSB';
        }else{
            aBrand='MSSB';
        }
		return aBrand;
    }
    
    function loadLoginSwf(){
		var flashvars = {};
		var params = {
			quality: "best",
			wmode: "opaque"
		 };
	
		var attributes = {};
	
		var brand = getBrand();  	
       
      	
	
		swfobject.embedSWF(eval(obj[brand]).swfname, "homepage_feature", eval(obj[brand]).width, eval(obj[brand]).height, "8.0.0", "/swfs/expressInstall.swf", flashvars, params, attributes); 
    }

	function displayNoFlashImage(){
		var aBrand = getBrand();
		var aNoFlash = objNoFlash[aBrand];
		var aPopup = popupFeatures[aBrand];
            
	    
	    
        if(aBrand == "MSSB"){
			document.write('<a onclick="advancedpopup2(\''+aPopup.href+'\', \''+aBrand+'\', '+aPopup.width+', '+aPopup.height+', 1, 1, 1, 1, 1, 1,'+aPopup.top+','+aPopup.left+'); return false;" href="Javascript:void(0);"><img src="'+aNoFlash.img+'" alt="'+aBrand+'" /></a>'); 
		}	
		else
		{
			document.write('<img src="'+aNoFlash.img+'" width="633" height="233" border="0" usemap="#Map" /><map name="Map" id="Map"><area shape="rect" coords="215,97,242,124" href="/research/investment_ideas" /><area shape="rect" coords="165,183,282,199" href="javascript:advancedpopup2(\''+aPopup.href+'\', \''+aBrand+'\', '+aPopup.width+', '+aPopup.height+', 1, 1, 1, 1, 1, 1,'+aPopup.top+','+aPopup.left+');" /></map>');
		}
	}


	function displayLiteLoginImage(){
		var aBrand = getBrand();
		var aNoFlash = liteObjNoFlash[aBrand];
		var aPopup = LitepopupFeatures[aBrand];
            
       	 if(aBrand == "MSSB"){
			document.write('<a onclick="advancedpopup2(\''+aPopup.href+'\', \''+aBrand+'\', '+aPopup.width+', '+aPopup.height+', 1, 1, 1, 1, 1, 1,'+aPopup.top+','+aPopup.left+');  return false;" href="javascript:void(0);"><img src="'+aNoFlash.img+'" alt="'+aBrand+'" /></a>'); 
		}else{
			document.write('<a href="'+aPopup.href+'"><img src="'+aNoFlash.img+'" alt="'+aBrand+'" /></a>'); 
		}
}

function openBannerWindow(url,w,h,offsetX,offsetY){
      var newwindow;
	newwindow= window.open("","bannerWindow","resizable=yes");
	newwindow.close();

	var viewportWidth = 0;
	var viewportHeight = 0;
	if (typeof window.innerWidth != 'undefined'){
	    viewportWidth = window.innerWidth,
		viewportHeight = window.innerHeight
	}
 	// IE6 in standards compliant mode (i.e. with a valid doctype as the first line in the document)
	else if (typeof document.documentElement != 'undefined'
     && typeof document.documentElement.clientWidth !=
     'undefined' && document.documentElement.clientWidth != 0){
		viewportWidth = document.documentElement.clientWidth,
		viewportHeight = document.documentElement.clientHeight
	}else{// older versions of IE
		viewportWidth = document.getElementsByTagName('body')[0].clientWidth,
		viewportHeight = document.getElementsByTagName('body')[0].clientHeight
	}

	var dialogWidth = viewportWidth - (viewportWidth * (parseInt(w)/100));
 	var dialogHeight = viewportHeight - (viewportHeight * (parseInt(h)/100));

	var parentLeft = typeof window.screenLeft != 'undefined' ? window.screenLeft : window.screenX;
	var parentTop = typeof window.screenTop != 'undefined' ? (parseInt(window.screenTop) - 150 ): window.screenY;

	var dialogLeft = parseInt(parentLeft) + parseInt(offsetX);
	var dialogTop = parseInt(parentTop) + parseInt(offsetY);

	newwindow = window.open(url,"bannerWindow","location=1,status=1,scrollbars=1,menubar=1,toolbar=1,resizable=1, width="+parseInt(dialogWidth)+"px,height="+parseInt(dialogHeight)+"px,LEFT="+parseInt(dialogLeft)+"px,TOP="+parseInt(dialogTop)+"px");
}
