function ObjectTag(url, width, height, bgColor, company) 
{ 
    this.width          =  width; 
    this.height         =  height;     
    this.bgColor 		=  bgColor;
    this.company 		=  company;
    this.url 			=  url;
    this.sku 			=  null;
    
    /** 
	  * Specifies the location (URL) of the content to be loaded. 
	  */ 
	 this.setSku = function(sku) 
	 { 
	     this.sku = sku;  
	 } 
	  
	 /** 
	  * Get the Object tag as a string.  
	  */ 
	 	 this.toString = function() 
	 { 
	    var objectTag = new String(); 
	    var embedTag = new String();
	    objectTag += '<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"';                
	    objectTag += ' codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,47,0" type="application/x-shockwave-flash"'; 
	    objectTag += ' ID="'+this.sku+'" width="'+this.width+'" height="'+this.height+'" ALIGN="">'; 
	    objectTag += '<param name="movie" value="'+this.url+this.sku+'&persistence=0"/>';
	    objectTag += '<param name=bgcolor value=#'+this.bgColor+ '>';
	    objectTag += '<param name=wmode value=transparent>';
	    objectTag += '<param name=allowScriptAccess value=always>';
	    
	    embedTag += '<embed src="'+this.url+this.sku+'&persistence=0"'; 
	    embedTag += ' width="'+this.width+'"'; 
	    embedTag += ' height="'+this.height+'"'; 	    
	    embedTag += ' name="'+this.sku+'"'; 
	    embedTag += ' type="application/x-shockwave-flash"'; 
	    embedTag += ' BGCOLOR="#'+this.bgColor+'"';
	 
	    objectTag += '<PARAM NAME=menu VALUE=false> <PARAM NAME=quality VALUE=high> <PARAM NAME=scale VALUE=noscale> <PARAM NAME=salign VALUE=LT><param NAME="wmode" VALUE="Transparent">';
	    embedTag += ' QUALITY="high" SWLIVECONNECT="true" ALLOWSCRIPTACCESS="always" WMODE="transparent" PLUGINSPAGE="http://www.macromedia.com/go/getflashplayer">';
	    
	    embedTag += '</embed>'; 
	    objectTag += embedTag;
	    objectTag += '</object>'; 
	    
	    return objectTag; 
	 } 
 } 
  
 

var colorList = new Array();



function addColor(pColorCode, pColorName, pProductImageURL){
	colorList.push(new Color(pColorCode, pColorName, pProductImageURL));
}

function getColor(pColorCode){
	for(var i=0;i<colorList.length;i++){
		if(colorList[i].colorCode == pColorCode){
			return colorList[i];
		}
	}
	return null;
}

function addView(pColorCode, pViewName, pViewURL){
	var color = getColor(pColorCode);
	if(color != null){
		color.addView(pViewName, pViewURL);
	}
}

function getViewList(pColor){
	if(pColor != null){
		return pColor.viewList;
	} else {
		return null;
	}	
}

function setAlternateViews(pColor){
	var viewList = getViewList(pColor);
	var altViewMain = getElement("alternateViews");
	if(viewList!=null && viewList.length>0){		
		altViewMain.style.display="inline";
		var altViewElement = getElement("alternateviewlist");
		altViewElement.innerHTML = "";
		for(var i=0;i<viewList.length && i<6 ;i++){
		  //Code modified for displaying roll over text for more views   
	        var sceneUrl = "<img title=\""+viewList[i].viewName+"\" src=\""+scene7Url+viewList[i].viewURL+"?$"+moreView+"$\"/>";
	      //End of code modified for displaying roll over text for more views   
			altViewElement.innerHTML += "<li><a href=\"javascript:setViewer('"+viewList[i].viewURL+"');\" id=\""+viewList[i].viewURL+"\">"+sceneUrl+"</a></li>";
		}
	} else {		
		altViewMain.style.display="none";
	}
}

function setViewerWithColor(pColorCode){
	var color = getColor(pColorCode);
	setViewer(color.productImageURL);
	setAlternateViews(color);
    selectImageViewer(color.productImageURL);
}

function setViewer(pSku, url){
	//This code will be uncommented once we get the scene7viewer content.
	var viewerElement = getElement("scene7viewer");
	if(viewerElement != null && viewer!=null){
		viewer.setSku(pSku);
		
		if(MM_FlashCanPlay ) {
			viewerElement.innerHTML = viewer.toString();			
		} else {
			viewerElement.innerHTML = '<table width=400 height=300 border=1><tr><td bgcolor=#eeeeee align=center valign=center><font color=#000000 face=Arial size=2>This application requires<br><br> <b>Macromedia Flash Player 6</b><br><br><a href=http://www.macromedia.com/go/getflashplayer target=_blank>Click here to get the latest<br>Macromedia Flash Player.</a></font></td></tr></table>';
		}
	}
	selectImageViewer(pSku);
}
function selectImageViewer(imgEle){
	if (document.getElementById("alternateViews") == true)
	{
	var nav = document.getElementById("alternateViews");
	var link = nav.getElementsByTagName("a");
	for (var i=0; i<link.length; i++){
        if(link[i].id==imgEle){
           link[i].className="selected"; 
		}else{
           link[i].className="";
		}
	}
	}
}

