
/* @author: kinra
 * Example Use on client page: 
 * var product_keys = new Array("SG_FLASH_1_1");

   <product>
    <key>SG_POSTSCRIPTPRINTERDRIVERS_1_1</key>
    <label>PostScript printer drivers</label>
    <image_name>?</image_name>
    <file_system>file_system</file_system>
    <url>/support/products/printerdrivers.html</url>
   </product>

 */	
var productMap_ROOT_ELEMENT = "product_map";
var productMap_RECORD_ELEMENT = "product";
var myTime, startTime, endTime;
var debugData = false;
mydebug("ProductMap.js");
function mydebug(s, doTime) {
  if(debugData) {
	if(adobe.hostEnv.isSafari) {		
       // alert(s);
	} else {
	  //if(!document.all) {
           
           myTime = (new Date()).getTime();  
           
           if(doTime && !startTime) {
	       startTime = myTime;
	   } else if (doTime && startTime && !endTime) {
		endTime = myTime;
	   } else if(doTime && startTime && endTime) {
               adobe.Console.log("TIME::" + (endTime - startTime));
               startTime,endTime = null;			 
           } else {
               adobe.Console.log(myTime + "::" + s);			 
	   }            
	    
	 // }
	}
  }
}
		
						
var urlXSL_ProductData,urlXML_ProductData;

urlXML_ProductMap = '/lib/com.adobe/module/ProductMap/ProductMap.xml';	
urlXSL_ProductMap = '/lib/com.adobe/module/ProductMap/ProductMap.xsl';


/**
 * 
 *  XSL can change , render multiple widgets same XML  multiple views... 
 *  
 *  productMapType* is provided to specify view type or
 *  even simpler passin in the abbeviated form of the xls file name
 *  
 *  also is there other attributes that need state... at this point i dont want to think down the road of state... 
 *  just multiple incarnations of views thinking like xforms...
 * 
 *  keys are passed in sequence to trans form is there however due to ie late render onload i would trasiently need to store the
 *  transformed HTML fragment for each incarnation 
 *  
 *  - productMapType
 *  - transformedHTML
 *  var new ProductMap(productMapType)
 *  
 *  - possilbe seperate xml docs
 *  
 *  - ids cnfigurable... but then also support multiple type instances..?
 */

function ProductMap(_productMapType) {
  this.productMapType  = _productMapType; 
  this.transformedHTML = ""
  // ? conditional ?
  this.urlXSL;
  this.responseText;
  this.xmlFragment = new Array();
  this.processor;
  this.elIds = {} // can have several element ids... 
  this.product_keys; // each productMap can have its own list of products... 
  return this;	
}

var ProductMapCollection = {};
ProductMap.locale = "";

this.product_keys=this.product_keys.sort();

function create_productMapSelectOptions() {
	mydebug("create_productMapSelectOptions");
	 ProductMapCollection["productMapSelectOptions"] = new ProductMap("productMapSelectOptions");
    (ProductMapCollection["productMapSelectOptions"]).urlXSL = '/lib/com.adobe/module/ProductMap/ProductMap.Select.Options.xsl';	

    try { 
		if (productMapSelectOptions.product_keys) {
			ProductMap.setProductKeys("productMapSelectOptions", productMapSelectOptions);
		} else {
			throw new Exception();
		}
	} catch(ex) {
	   mydebug("Error: productMapSelectOptions: is not defined");
	}
}

function create_productMap_kbSmall() {	
    mydebug("create_productMap_kbSmall");
    ProductMapCollection["productMap_kbSmall"] = new ProductMap("productMap_kbSmall");
    (ProductMapCollection["productMap_kbSmall"]).urlXSL = '/lib/com.adobe/module/ProductMap/ProductMap.xsl';

	try { 
		if (productMap_kbSmall.product_keys) {
			ProductMap.setProductKeys("productMap_kbSmall", productMap_kbSmall);
		} else {
			throw new Exception();
		}
	} catch(ex) {
	   mydebug("Error: productMap_kbSmall: is not defined");
	   	ProductMap.setProductKeys("productMap_kbSmall", product_keys);		
	}			
}

ProductMap.setProductKeys = function(productMapType, obj){
	mydebug("ProductMap.setProductKeys");
   if(obj.product_keys) {
    (ProductMapCollection[productMapType]).product_keys = obj.product_keys;
   } else {
    (ProductMapCollection[productMapType]).product_keys = product_keys;   	
   }
}




ProductMap.createByType = function() {
	try { if(productMap_kbSmall) {} } catch (ex) {	productMap_kbSmall = false; }
	try { if(productMapSelectOptions) {} } catch (ex) {	productMapSelectOptions = false; }

	try {
	  if ((!productMap_kbSmall) && (productMapSelectOptions)) {    	
         create_productMapSelectOptions();
	  } else if((productMap_kbSmall) && (productMapSelectOptions)){
	  	 mydebug("CREATE BOTH!!!!");
         create_productMapSelectOptions();
		 
	     create_productMap_kbSmall();	
	  
	  } else {  	
	     create_productMap_kbSmall();	
	  }
	  
	  //alert((ProductMapCollection["productMapSelectOptions"]).urlXSL);	

	  //productMapSmall = true;
	} catch (ex) {
	  alert(ex.message);	
	}
}

ProductMap.createByType();
/*******************************************************************************/	
// the ajax begins... 

ProductMap.startAjaxChain = function() { 	
  mydebug("ProductMap.startAjaxChain::");
  //if (product_keys.length >= 1) { // merge // this is not really applicable this would have to be done more by type.
  	new Ajax.Request(ProductMapArray[0].urlXSL, {
  		method: 'post',
  		onSuccess: ProductMap.storeResponseText
  	});
  //}
}		 

var ProductMapArray = new Array();

var any_product_keys = false;

try { if(product_keys[0] != "") { any_product_keys = true; } else { window.setTimeout(setProductMapInnerHTML,1000 * 3); } } catch(ex) { window.setTimeout(setProductMapInnerHTML,1000 * 4); }
try { if(productMapSelectOptions['product_keys'][0] != "") { any_product_keys = true; } } catch(ex) {}
try { if(productMap_kbSmall['product_keys'][0] != "") { any_product_keys = true; } else { window.setTimeout(setProductMapInnerHTML,1000 * 3); } } catch(ex) { window.setTimeout(setProductMapInnerHTML,1000 * 4); }

if(any_product_keys) {
    new Ajax.Request(urlXML_ProductMap,{ method: 'post', onSuccess: getXML_ProductMap });	        
} else {
  // throw exception here
   mydebug("ERROR: missing product_keys i.e. SG_FLASH_1_1 please set the values in an arrary on the client caled prodcut keys.");      
}


ProductMap.startAjaxLoop = function(){
	var count = 0;
	mydebug("ProductMap.startAjaxLoop::");
	for (var productMapType in ProductMapCollection) {
		ProductMapArray[count] = (ProductMapCollection[productMapType]);
	    mydebug("ProductMap.startAjaxLoop::count" + count + "::" + ProductMapArray[count].urlXSL);
		count = count + 1;
	}
	
	ProductMap.startAjaxChain();
}


ProductMap.storeResponseText = function(xslhr,obj){
  mydebug("ProductMap.storeResponseText::ProductMapArray.length::" + ProductMapArray.length);
  var xslStr = xslhr.responseText;
  (ProductMapArray[0]).responseText = xslStr;
   // ProductMap.startAjaxChain();
   try {
     ProductMapArray.shift();
     if (ProductMapArray.length > 0) {
 
	 	ProductMap.startAjaxChain();

	 } else {
mydebug("CALL TO GET XSL!!!!!!!!!!!");
	 	getXSL_ProductMap();

	 }  
   } catch(ex) {
   	   alert(ex);
   }
}

		 
		    				  		  
//var processor; // only one processor
function getXSL_ProductMap(/*xslhr,obj*/) {		
	mydebug("getXSL_ProductMap");
	//var serializer = new XMLSerializer()
    //put time test here... 
	//loop based on keys...
	for (var productMapType in ProductMapCollection) {		
		//alert('key is: ' + productMapType + ', value is: ' + ProductMapCollection[productMapType]);
	    (ProductMapCollection[productMapType]).processor = ((adobe.hostEnv.isSafari)?new Safari_XSLTProcessor():new XSLTProcessor());

		var xslDoc = Sarissa.getDomDocument();
		//var xslStr = xslhr.responseText;
	    var xslStr = (ProductMapCollection[productMapType]).responseText
		
	        // make special case for Safari.... so that we dont need an entirly new template.
	
		if(adobe.hostEnv.isSafari) {
	  		xslStr = xslStr.replace('<xsl:for-each select="/' + productMap_ROOT_ELEMENT +'/' + productMap_RECORD_ELEMENT + '">','<xsl:for-each select="./' + productMap_RECORD_ELEMENT + '">');
		}
	
	        xslDoc = (new DOMParser()).parseFromString(xslStr, "text/xml");
	
		//mydebug(xslStr);
	
		try{ 			
		  (ProductMapCollection[productMapType]).processor.importStylesheet(xslDoc);
		} catch(ex) {
		    alert(productMapType + ".processor.importStylesheet:" + ex);
		}
	
	}
        // kinra: this will need to change  for now its one static XML for all ProductMap widgets 
        //new Ajax.Request(urlXML_ProductMap,{ method: 'post', onSuccess: getXML_ProductMap });	  
        doTransform_ProductMap(/*ProductMap.oDoc, productMapType*/);	


} // end function 

ProductMap.oDoc;
function getXML_ProductMap(xmlhr /*, productMapType*/) {		
  mydebug("getXML_ProductMap");

  var xmlString = xmlhr.responseText;
  //mydebug("getXML_ProductMap 1" + xmlString);

  //if(product_keys[0] == "*") {
    ProductMap.oDoc = (new DOMParser()).parseFromString(xmlString, "text/xml");
  //} else {
    // only get the products needed by SG_ID
   //try {
     //ProductMap.oDoc = getXMLFragment_ForProductKeys(xmlString)
   //} catch(ex) {   	 
   //} 
   
   try {
     ProductMap.getXMLFragments_ForProductKeys(xmlString);
   } catch(ex) {
   	 mydebug(ex.message);
   } 
     
  //}
  oDomDocString = (new XMLSerializer().serializeToString(ProductMap.oDoc));
   

  if(oDomDocString.length <= 0) {
    mydebug("No <xml> was found. Invalid XML.");
    	return;		
  }


  // TOKEN - MAKE THIS A TOKEN DO NOT HARD CODE!!!
  if((new String(oDomDocString)).indexOf("<" + productMap_ROOT_ELEMENT) == -1) { 
     mydebug("No <" + productMap_ROOT_ELEMENT +"> found. Invalid XML.");
     return;
  } else {
    mydebug("<" + productMap_ROOT_ELEMENT + "> was found. Valid XML.");
    //mydebug("oDomDocString\n" + oDomDocString);
    /// doTransform_ProductMap(oDoc/*, productMapType*/);	
	ProductMap.startAjaxLoop();
  }
}  // end function 


ProductMap.getXMLFragments_ForProductKeys = function(xmlString) {
mydebug("ProductMap.getXMLFragments_ForProductKeys::xmlString::" + xmlString);	
	for (var productMapType in ProductMapCollection) {
	   try {	 
        if((ProductMapCollection[productMapType]).product_keys) {
		    (ProductMapCollection[productMapType]).xmlFragment = getXMLFragment_ForProductKeys(xmlString, productMapType);
		} else {
	   	   mydebug("No Product Keys Found");			
		}	      
	   } catch(ex) {
	   	   mydebug(ex.message);
	   }
	}
}

var myMatchNumber = 0; // merge  // externalize this out side of function.



/*
 * try remove method as well 
 * IMPORTANT... PLEASE USE SELECT OR XPATHS NO NOT USE childNodes[x]
*/
function getXMLFragment_ForProductKeys(xmlString, productMapType) {

  mydebug("getXMLFragment_ForProductKeys::START::");

// create a doc that i can select specific product fragments 
// then create a new doc based on those fragments
  var oDoc = (new DOMParser()).parseFromString(xmlString, "text/xml");
  var productList = oDoc.getElementsByTagName("product");
  var myProductKey;
  var myProductLabel;
  var productListIndexes = new Array(); 
  var productListEntities = new Array(); 
  




  // make exception short case for myMatchNumber 
  for(var j=0; j<productList.length; j++) {

    //myProductKey = productList[j].childNodes[1].childNodes[0].nodeValue;
    //productList[j] = productList[j].normalize();
    // put saftey case if no text node. 

    myProductKey = productList[j].getElementsByTagName("key")[0].childNodes[0].nodeValue;  	
    // myProductLabel = productList[j].getElementsByTagName("label")[0].childNodes[0].nodeValue;  		
	  
    //mydebug("" + myProductKey + "")
    
    //
	var _product_keys = (ProductMapCollection[productMapType]).product_keys;
		
    var productFragment;
	try {
    if(_product_keys[0] == "*") {
		//mydebug("show all ")
	      try {
	          // we got a match
	
				  myMatchNumber = myMatchNumber + 1;
	              productListIndexes[productListIndexes.length] = j; 
			      productListEntities[j] = productList[j]; 	
			  		  
	            //mydebug("show all case:" + myProductLabel);    
	          // else {
	            //  mydebug("show all case ex for :" + myProductLabel);    
			  //}
			  //mydebug("MATCHED:"  + myProductKey + " productListIndexes:" + j);
	      } catch(ex) {
	        mydebug("ERROR: XML PRODCUCT FRAGMENT:" + ex + "\n" + oDoc.prototype);      
	      }
	} else {	
	    mydebug("_product_keys.length::" + _product_keys.length);
		for(var i=0; i<_product_keys.length; i++) {
	      //mydebug("_product_keys[" + _product_keys[i] + "]");
	      try {
	        if(_product_keys[i] == myProductKey) {
	          // we got a match
	          myMatchNumber = myMatchNumber + 1;
	          productListIndexes[productListIndexes.length] = j; 
	          productListEntities[i] = productList[j];           
			  mydebug("MATCHED:"  + myProductKey + " productListIndexes:" + j);
	          break;         
		    } 
	      } catch(ex) {
	        mydebug("ERROR: XML PRODCUCT FRAGMENT:" + ex + "\n" + oDoc.prototype);      
	      }
	    }  // end inner for
    }
    } catch(ex) {}

    //mydebug("myMatchNumber:" + myMatchNumber)
    // put the breaks on if found all product_keys
    if(myMatchNumber == (_product_keys.length) && _product_keys[0] != "*") {
	  mydebug(" myMatchNumber == (_product_keys.length + 1) putting on the brakes");	
      break;
    }
  } // end outer for
  
  mydebug("myMatchNumber:" + myMatchNumber)

  // put this above some where so it does not affect the time 
  var newODoc = Sarissa.getDomDocument();
  var newProductMap = newODoc.createElement("product_map");                 


  //create fragment
  for(var h=0; h<productListEntities.length; h++) {
   // mydebug("USE ONLY THESE NODES::" +  productList[productListIndexes[h]].getElementsByTagName("key")[0].childNodes[0].nodeValue); 
   // mydebug("USE ONLY THESE NODES::" +  productList[productListIndexes[h]].getElementsByTagName("label")[0].childNodes[0].nodeValue); 
    //mydebug("USE ONLY THESE NODES::IMAGE_NAME::" +  productList[productListIndexes[h]].getElementsByTagName("image_name")[0].childNodes[0].nodeValue); 
   // mydebug("USE ONLY THESE NODES::" +  productList[productListIndexes[h]].getElementsByTagName("file_system")[0].childNodes[0].nodeValue); 
   // mydebug("USE ONLY THESE NODES::" +  productList[productListIndexes[h]].getElementsByTagName("url")[0].childNodes[0].nodeValue); 
    
	// Due to limitations in Safari 2 xsl and not wanting to go through creating custom XSLT fiunctions
	// I will manually do replacements here rather than in the xsl
	// http://www.adobe.com/support/service/
		
    var keyValue = productListEntities[h].getElementsByTagName("key")[0].childNodes[0].nodeValue;
    var labelValue = productListEntities[h].getElementsByTagName("label")[0].childNodes[0].nodeValue;

    var urlValue = productListEntities[h].getElementsByTagName("url")[0].childNodes[0];
	if(urlValue.nodeValue == "url" || urlValue.nodeValue == "" /* begins with http do match */) {
	  urlValue.nodeValue = "http://www.adobe.com/support/service/"
	} else {
		if(ProductMap.locale != "") { 
		  urlValue.nodeValue = "http://www.adobe.com/" + ProductMap.locale + urlValue.nodeValue;		
		} else {
		  urlValue.nodeValue = "http://www.adobe.com" + urlValue.nodeValue;			
		}		
	}
	
    var imgValue = productListEntities[h].getElementsByTagName("image_name")[0].childNodes[0];
	if(imgValue.nodeValue == "?" || imgValue.nodeValue == "") {
	  imgValue.nodeValue = "blank_20x20.gif";
	} else {
		imgValue.nodeValue = imgValue.nodeValue + "_20x20.jpg";
	}
	
	//mydebug("productListEntities[h]:url:" + productListEntities[h].getElementsByTagName("url")[0].childNodes[0].nodeValue);
 	
	//mydebug("productListEntities[h]:" + productListEntities[h]);
    try  {
	  if ((labelValue != "") && 
		  (labelValue != "X")) {					
	        newProductMap.appendChild(productListEntities[h]); // do clone?
      }
	} catch(ex) {
		mydebug("Could Not add entitiy!!!" + ex);
			if(adobe.hostEnv.isSafari) {
			  if ((labelValue != "") && 
		          (labelValue != "X")) {		
				
			  try {
				  var newProduct = newODoc.createElement("product");                 
				  var newProduct_key = newODoc.createElement("key");                 
				  var newProduct_label = newODoc.createElement("label");                 
				  var newProduct_image_name = newODoc.createElement("image_name");                 
				  var newProduct_file_system = newODoc.createElement("file_system");                 
				  var newProduct_url = newODoc.createElement("url");                 
	
			      var keyNode = productListEntities[h].getElementsByTagName("key")[0].childNodes[0];
			      var labelNode = productListEntities[h].getElementsByTagName("label")[0].childNodes[0];
			      var image_nameNode = productListEntities[h].getElementsByTagName("image_name")[0].childNodes[0];
			      var file_systemNode = productListEntities[h].getElementsByTagName("file_system")[0].childNodes[0];
	 			
				  newProduct_key.appendChild(newODoc.createTextNode(keyNode.nodeValue));               
				  newProduct_label.appendChild(newODoc.createTextNode(labelNode.nodeValue));                 
				  newProduct_image_name.appendChild(newODoc.createTextNode(imgValue.nodeValue));                 
				  newProduct_file_system.appendChild(newODoc.createTextNode(file_systemNode.nodeValue));                 
				  newProduct_url.appendChild(newODoc.createTextNode(urlValue.nodeValue));			
				
				  newProduct.appendChild(newProduct_key);
				  newProduct.appendChild(newProduct_label);
				  newProduct.appendChild(newProduct_image_name);
				  newProduct.appendChild(newProduct_file_system);
				  newProduct.appendChild(newProduct_url);
			 
			    newProductMap.appendChild(newProduct);
			  } catch(ex) {
			  	mydebug("Safari is wack!" + ex);
			  }
			  }
			}
	}
	//newProductMap.appendChild(productList[productListIndexes[h]].clone()); // do clone?

  }

    newODoc.appendChild(newProductMap);
    mydebug("getXMLFragment_ForProductKeys::END");

    //if (debugData) {
		//var docStringx = (new XMLSerializer().serializeToString(newODoc));
	//}	
	//mydebug("returning docStringx::" + docStringx);
  
  //oDoc = (new DOMParser()).parseFromString(xmlString, "text/xml");

  return newODoc;

}

var myProductMap = "";	// merge // externalize this out side of function.

//var myProductMapHTML = "";
function doTransform_ProductMap(/*oDoc/*, productMapType*/) {
    mydebug("doTransform::==========================================>")	
    
  for (var productMapType in ProductMapCollection) {
    mydebug("doTransform::~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~>")	
  	
  	       //mydebug('key is: ' + productMapType + ', value is: ' + (ProductMapCollection[productMapType]).responseText );
			
			var myDoc = (ProductMapCollection[productMapType]).xmlFragment;//oDoc;	
			mydebug(myDoc[0]);		
			var newDocument;
			
			if (adobe.hostEnv.isSafari) {
				newDocument = null;
				newDocument = (ProductMapCollection[productMapType]).processor.transformToFragment(myDoc);
			}
			else {
				try {
					newDocument = (ProductMapCollection[productMapType]).processor.transformToDocument(myDoc);
				} 
				catch (ex) {
					mydebug("ex:" + ex.message);
					return;
				}
			}
			try {
			
				(ProductMapCollection[productMapType]).transformedHTML = new XMLSerializer().serializeToString(newDocument);
				
				mydebug("SUCCESS:serilaized " + productMapType + " newDocument")
				mydebug("SUCCESS:doTransform::" + (ProductMapCollection[productMapType]).transformedHTML);
			} 
			catch (ex) {				
				mydebug("EX:could not serilaize newDocument:" + ex)
			}
			
		} // close loop 
	 
       setProductMapInnerHTML();
}

function setProductMapInnerHTML() {
	   mydebug("setProductMapInnerHTML:");	   	   
	   registerOnLoad(_setProductMapInnerHTML);
}

function _setProductMapInnerHTML() {
	   mydebug("_setProductMapInnerHTML:");	   	   
	   setProductMapData_kbSmall();
	   setProductMapData_select();
}

ProductMap.selectName = "searchProduct";
ProductMap.selectId = "productMap_select";

function setProductMapData_select() {
	   mydebug("setProductMapData_select:");	   	  
	   //mydebug("setProductMapData_select:" + ProductMapCollection['productMapSelectOptions'].transformedHTML);	   	  

	   try { 
		 if ($(ProductMap.selectId)) {			
			$(ProductMap.selectId).removeAttribute("disabled");			
		 	//alert(ProductMapCollection['productMapSelectOptions'].transformedHTML);

				ProductMapCollection['productMapSelectOptions'].transformedHTML = (ProductMapCollection['productMapSelectOptions'].transformedHTML).replace("<?xml version=\"1.0\" encoding=\"UTF-16\"?>", "");
				ProductMapCollection['productMapSelectOptions'].transformedHTML = (ProductMapCollection['productMapSelectOptions'].transformedHTML).replace("<select xmlns=\"http://www.w3.org/1999/xhtml\">", "");
				ProductMapCollection['productMapSelectOptions'].transformedHTML = (ProductMapCollection['productMapSelectOptions'].transformedHTML).replace("</select>", "");

			mydebug(ProductMapCollection['productMapSelectOptions'].transformedHTML);
				
				if (document.all) { // test in IE7	     
					//$('productMap_select')
					// get all attributes of the select box
					//alert(Object.inspect($('productMap_select')));		 
					// would have to dynamically get all attributes for the given select... 
					$(ProductMap.selectId).outerHTML = "<select id='" + ProductMap.selectId + "' name='" + ProductMap.selectName + "'>" + (ProductMapCollection['productMapSelectOptions']).transformedHTML + "</select>";
				}
				else {
					$(ProductMap.selectId).innerHTML = (ProductMapCollection['productMapSelectOptions']).transformedHTML;
				}
		}	   
	   } catch (ex) {	   	 
		   alert(ex)			   
	   }		   	
}

function setProductMapData_kbSmall() {
	var lengthCheck = (adobe.hostEnv.ieV > 0) ? 232: 223;
   try { 
      if((ProductMapCollection['productMap_kbSmall']).transformedHTML.length <= lengthCheck) { // bad but ok for now
	      $('product_map_side').innerHTML = "N/A";
	  } else {
	  	  $('product_map_side').innerHTML = (ProductMapCollection['productMap_kbSmall']).transformedHTML; 
	  }

   } catch (ex) {   mydebug("setProductMapData_kbSmall::1");	}

   try { 
      if((ProductMapCollection['productMap_kbSmall']).transformedHTML.length <= lengthCheck) {
	      $('product_map_bottom').innerHTML = "N/A";
	  } else {
	  	  $('product_map_bottom').innerHTML = (ProductMapCollection['productMap_kbSmall']).transformedHTML; 
	  }
   } catch (ex) { mydebug("setProductMapData_kbSmall::2"); } 

mydebug("setProductMapData_kbSmall::3");

   productMap_kbSmall_IE_containerRezize();	
}

//   //<div id="productMap_kbSmall" style="border: 1px solid #DDD; padding: 3px; max-height: 270px; _height: 290px; overflow: auto; overflow-x:hidden;overflow-y: auto;">
    
function productMap_kbSmall_IE_containerRezize() {
	try  {
	  // will have to get them both 
	  if(myMatchNumber >= 10) {
	    $('product_map_side').childNodes[0].style.height = "270px";	
	    $('product_map_bottom').childNodes[0].style.height = "285px";	
	  }
	} catch (ex) {
		
	}  
}
