function CCollection() {
     var lsize = 0;
     this.add = _add;
     this.remove = _remove;
     this.isEmpty = _isEmpty;
     this.size = _size;
     this.clear = _clear;
     function _add(newItem) {
          if (newItem == null) return;
          lsize++;
          this[(lsize - 1)] = newItem;
     }
     function _remove(index) {
          if (index < 0 || index > this.length - 1) return;
          this[index] = null;
          for (var i = index; i <= lsize; i++)
               this[i] = this[i + 1];
          lsize--;
     }
     function _isEmpty() { return lsize == 0 }     
     function _size() { return lsize }    
     function _clear() {
          for (var i = 0; i < lsize; i++)
               this[i] = null;
          lsize = 0;
     }
}
function FeaturedIndustry(industry){
  this.industryName=industry;
  this.apparea_size=0;
	this.image;
	this.htmlName;
	this.sptr;
	this.teaser;
	this.appAreaName = new Array();
}
FeaturedIndustry.prototype.getName = function(){
  return this.industryName;
}
FeaturedIndustry.prototype.setHtmlName = function(hname){
  return this.htmlName = hname;
}
FeaturedIndustry.prototype.getHtmlName = function(){
  return this.htmlName;
}
FeaturedIndustry.prototype.getLink = function(){
  return "/gep/Plastics/"+lang+"/IndustryApplications/IndustryDetail/"+formatField(this.htmlName)+".html";
}
FeaturedIndustry.prototype.addApplicationArea = function(AppAreaName){
  this.appAreaName[this.apparea_size++]=AppAreaName;
}
FeaturedIndustry.prototype.setImage = function(Image){
  this.image=Image;
}
FeaturedIndustry.prototype.getImage = function(){
    return "http://imageserver.geampod.kcbam.net/KBAMImagingServer/Scripts/resize.kix?FileName=http://kbam.geampod.com/KBAM/reflection/Assets/"+this.image+"&Width1=60&Height1=60&Unit1=Pixels&Format1=png";
}
FeaturedIndustry.prototype.getImageID = function(){
    return this.image;
}
FeaturedIndustry.prototype.setTeaser = function (Teaser){
  this.teaser=Teaser;
}
FeaturedIndustry.prototype.getTeaser = function (){
  return this.teaser;
}
FeaturedIndustry.prototype.getAppAreaSize = function (){
  return this.apparea_size;
}
FeaturedIndustry.prototype.getApplicationArea = function(idx){
  return this.appAreaName[idx];
}
FeaturedIndustry.prototype.setServletParameter = function(ptr){
  this.sptr=ptr;
}
FeaturedIndustry.prototype.getServletParameter = function(){
  return this.sptr;
}
FeaturedIndustry.prototype.getLiteratureLink = function(){
  return "/gepapp/Plastics/global/jsp/Literature/LiteratureAndTools.jsp?literatureType=Industry%20Brochure&product=All&language=All&solutionArea=Resins&industryApplication="+URLEncode(this.htmlName);  
}
function OtherIndustry(industry){
  this.industryName=industry;
  this.apparea_size=0;
	this.image;
	this.htmlName;
	this.sptr;
	this.teaser;
	this.appAreaName = new Array();
}
OtherIndustry.prototype.setHtmlName = function(hname){
  return this.htmlName = hname;
}
OtherIndustry.prototype.getHtmlName = function(){
  return this.htmlName;
}
OtherIndustry.prototype.getName = function(){
  return this.industryName;
}
OtherIndustry.prototype.getLink = function(){
  return "/gep/Plastics/"+lang+"/IndustryApplications/IndustryDetail/"+formatField(this.htmlName)+".html";
}
OtherIndustry.prototype.addApplicationArea = function(AppAreaName){
  this.appAreaName[this.apparea_size++]=AppAreaName;
}
OtherIndustry.prototype.setImage = function(Image){
  this.image=Image;
}
OtherIndustry.prototype.getImage = function(){
    return "http://imageserver.geampod.kcbam.net/KBAMImagingServer/Scripts/resize.kix?FileName=http://kbam.geampod.com/KBAM/reflection/Assets/"+this.image+"&Width1=60&Height1=60&Unit1=Pixels&Format1=png";
}
OtherIndustry.prototype.getImageID = function(){
    return this.image;
}
OtherIndustry.prototype.setTeaser = function (Teaser){
  this.teaser=Teaser;
}
OtherIndustry.prototype.getTeaser = function (){
  return this.teaser;
}
OtherIndustry.prototype.getAppAreaSize = function (){
  return this.apparea_size;
}
OtherIndustry.prototype.getApplicationArea = function(idx){
  return this.appAreaName[idx];
}
OtherIndustry.prototype.setServletParameter = function(ptr){
  this.sptr=ptr;
}
OtherIndustry.prototype.getServletParameter = function(){
  return this.sptr;
}
OtherIndustry.prototype.getLiteratureLink = function(){
  return "/gepapp/Plastics/global/jsp/Literature/LiteratureAndTools.jsp?literatureType=Industry%20Brochure&product=All&language=All&solutionArea=Resins&industryApplication="+URLEncode(this.htmlName);
}
function ApplicationArea(AppArea){
  this.app_size=0;
	this.appAreaName=AppArea;
	this.appName = new Array();
	this.getName=_getName;
	this.getAppSize=_getAppSize;
	this.addApplication=_addApplication;
	this.getApplication=_getApplication;
	function _getName(){
    return this.appAreaName;
  }
  function _addApplication(App){
    this.appName[this.app_size++]=App;
  }
  function _getAppSize(){
    return this.app_size;
  }
  function _getApplication(idx){
     return this.appName[idx];
  }
}
function Application(App){
	this.appName=App;
	this.htmlName;
	this.getLink=_getLink;
	this.getName=_getName;
	this.setHtmlName=_setHtmlName;
	this.getHtmlName=_getHtmlName;
	function _getName(){
	   return this.appName;
  }
	function _setHtmlName(Name){
	   this.htmlName=Name;
  }
	function _getHtmlName(){
	   return this.htmlName;
  }
	function _getLink(){
	  var temp=formatField(this.htmlName);
    temp=temp.replace(/\$/g,"_");
    return "/gep/Plastics/"+lang+"/IndustryApplications/Applications/"+temp+".html";
  }
}
function displaySolArea(){
		  document.writeln("<label for=\"SolArea\">Solution Area</label>");
      document.writeln("<select id=\"solArea\"  name=\"solArea\" style=\"width:100px;\">");
    	document.writeln("<option>Select Solution Area</option>");
      document.writeln("<option>Resins</option>");
      document.writeln("<option selected>Specialty Film &amp; Sheet</option>");
      document.writeln("<option>Polymershapes</option>");
			document.writeln("</select>");
   		document.writeln("<input type=\"image\" src=\"/gep/Plastics/css/images/go.gif\" align=\"top\" alt=\"GO\" onclick=\"return submitSolutionForm();\" value=\"Change URL\"/>");
      document.writeln("<p/>");   		
}
function addSolAreaJS(){
      document.writeln("<script>");
			document.writeln("function submitSolutionForm(){");				
		  document.writeln("var x=document.getElementById(\"solArea\")");
 			document.writeln("if(x.selectedIndex == 0){");
      document.writeln("alert(\"Select solution area\");");
      document.writeln("return false;");
      document.writeln("}");
      document.writeln("if(x.selectedIndex == 1){");
      document.writeln("window.location.href=\"/gep/Plastics/"+lang+"/Home/Home/home.html\";");
      document.writeln("return false;");
      document.writeln("}");
      document.writeln("if(x.selectedIndex == 2){");
      document.writeln("window.location.href=\"/sfs/SFS/"+lang+"/HomePage/Home/home.html\";");
      document.writeln("return false;");
      document.writeln("}");
      document.writeln("if(x.selectedIndex == 3){");
      document.writeln("window.location.href=\"http://www.sabicpolymershapes.com/\";");
      document.writeln("return false;");
      document.writeln("}");
		  document.writeln("}");		
		  document.writeln("<\/script>");
}  
function URLEncode(ptr)
{
	// The Javascript escape and unescape functions do not correspond
	// with what browsers actually do...
	var SAFECHARS = "0123456789" +					// Numeric
					"ABCDEFGHIJKLMNOPQRSTUVWXYZ" +	// Alphabetic
					"abcdefghijklmnopqrstuvwxyz" +
					"-_.!~*'()";					// RFC2396 Mark characters
	var HEX = "0123456789ABCDEF";
	var plaintext = ptr;
	var encoded = "";
	for (var i = 0; i < plaintext.length; i++ ) {
		var ch = plaintext.charAt(i);
	    if (ch == " ") {
		    encoded += "+";				// x-www-urlencoded, rather than %20
		} else if (SAFECHARS.indexOf(ch) != -1) {
		    encoded += ch;
		} else {
		    var charCode = ch.charCodeAt(0);
			if (charCode > 255) {
			    alert( "Unicode Character '" 
                        + ch 
                        + "' cannot be encoded using standard URL encoding.\n" +
				          "(URL encoding only supports 8-bit characters.)\n" +
						  "A space (+) will be substituted." );
				encoded += "+";
			} else {
				encoded += "%";
				encoded += HEX.charAt((charCode >> 4) & 0xF);
				encoded += HEX.charAt(charCode & 0xF);
			}
		}
	} // for
	return encoded;
}
function URLDecode(ptr)
{
   // Replace + with ' '
   // Replace %xx with equivalent character
   // Put [ERROR] in output if %xx is invalid.
   var HEXCHARS = "0123456789ABCDEFabcdef"; 
   var encoded = ptr;
   var plaintext = "";
   var i = 0;
   while (i < encoded.length) {
       var ch = encoded.charAt(i);
	   if (ch == "+") {
	       plaintext += " ";
		   i++;
	   } else if (ch == "%") {
			if (i < (encoded.length-2) 
					&& HEXCHARS.indexOf(encoded.charAt(i+1)) != -1 
					&& HEXCHARS.indexOf(encoded.charAt(i+2)) != -1 ) {
				plaintext += unescape( encoded.substr(i,3) );
				i += 3;
			} else {
				alert( 'Bad escape combination near ...' + encoded.substr(i) );
				plaintext += "%[ERROR]";
				i++;
			}
		} else {
		   plaintext += ch;
		   i++;
		}
	} // while
   return plaintext;
};
function CaseStudy(tle){
	this.title=tle;
	this.image;
	this.link;
	this.solutionArea;
	this.prodLine = new Array();
	this.prodFamily = new Array();
	this.industry;
	this.application;
	this.description;
	this.prdFam_size=0;
	this.prdLine_size=0;
	this.getTitle=_getTitle;
	this.getImage=_getImage;
	this.getLink=_getLink;
	this.getSolutionArea=_getSolutionArea;
	this.getIndustry=_getIndustry;
	this.getApplication=_getApplication;
	this.getDescription=_getDescription;
	this.getProductFamily=_getProductFamily;
	this.getProductFamilySize=_getProductFamilySize;
	this.getProductLine=_getProductLine;
	this.getProductLineSize=_getProductLineSize;        
	this.setImage=_setImage;
	this.setLink=_setLink; 
	this.setSolutionArea=_setSolutionArea;
	this.setIndustry=_setIndustry;
	this.setApplication=_setApplication;
	this.setDescription=_setDescription;
	this.addProductFamily=_addProductFamily;
	this.addProductLine=_addProductLine;
	function _getTitle(){
	      return this.title;
	}
	function _getImage(){
      	return	"http://imageserver.geampod.kcbam.net/KBAMImagingServer/Scripts/resize.kix?FileName=http://kbam.geampod.com/KBAM/reflection/Assets/"+this.image+"&Width1=60&Height1=60&Unit1=Pixels";
	}
	function _setImage(img){
      	this.image=img;
	}    
	function _getLink(){
      	return this.link;
	}
	function _setLink(lnk){
		this.link = lnk;
	}
	function _getSolutionArea(){
		return this.solutionArea;
	}
	function _setSolutionArea(soln){
		this.solutionArea = soln;
	}
	function _getIndustry(){
		return this.industry;
	}
	function _setIndustry(ind){
		this.industry = ind;
	}
	function _getApplication(){
		return this.application;
	}
	function _setApplication(appln){
		this.application = appln;
	}
	function _getDescription(){
		return this.description;
	}
	function _setDescription(descr){
		this.description = descr;
	}    
	function _addProductFamily(ProdFamName){
		this.prodFamily[this.prdFam_size++]=ProdFamName;
	}
	function _getProductFamilySize(){
		return this.prdFam_size;
	}
	function _getProductFamily(idx){
		return this.prodFamily[idx];
	}
	function _addProductLine(ProdLnName){
		this.prodLine[this.prdLine_size++]=ProdLnName;
	}
	function _getProductLineSize(){
		return this.prdLine_size;
	}
	function _getProductLine(idx){
		return this.prodLine[idx];
	} 
}
function NewProduct(tle){
	this.title=tle;
	this.link;
	this.end_date;
	this.image;
	this.teaser;
	this.product;
	this.solutionArea;
	this.getTitle=_getTitle;
	this.getLink=_getLink;
	this.getEndDate=_getEndDate;
	this.getImage=_getImage;
	this.getTeaser=_getTeaser;
	this.getProduct=_getProduct;
	this.getSolutionArea=_getSolutionArea;
	this.setLink=_setLink;
	this.setEndDate=_setEndDate;
	this.setImage=_setImage;
	this.setTeaser=_setTeaser;
	this.setProduct=_setProduct;
	this.setSolutionArea=_setSolutionArea;
  function _getTitle(){
	      return this.title;
	}
	function _getLink(){
      	return this.link;
	}
	function _setLink(lnk){
		this.link = lnk;
	}
	function _getEndDate(){
      	return this.end_date;
	}
	function _setEndDate(edate){
		this.end_date = edate;
	}
	function _getImage(){
      	return	this.image;
	}
	function _setImage(img){
      	this.image=img;
	}    
	function _getTeaser(){
      	return this.teaser;
	}
	function _setTeaser(tsr){
		this.teaser = tsr;
	}
	function _getProduct(){
      	return this.product;
	}
	function _setProduct(prod){
		this.product = prod;
	}
	function _getSolutionArea(){
		return this.solutionArea;
	}
	function _setSolutionArea(soln){
		this.solutionArea = soln;
	}
}

function ProcessingType(tle){
	this.title=tle;
	this.link;
	this.image;
	this.teaser;
	this.getTitle=_getTitle;
	this.getLink=_getLink;
	this.getImage=_getImage;
	this.getTeaser=_getTeaser;
	this.setLink=_setLink;
	this.setImage=_setImage;
	this.setTeaser=_setTeaser;
  function _getTitle(){
	      return this.title;
	}
	function _getLink(){
      	return this.link;
	}
	function _setLink(lnk){
		this.link = lnk;
	}
	function _getImage(){
      	return	this.image;
	}
	function _setImage(img){
      	this.image=img;
	}    
	function _getTeaser(){
      	return this.teaser;
	}
	function _setTeaser(tsr){
		this.teaser = tsr;
	}
	
}	


function UtfToUnicode(utf) {
  var tstr = utf;
  var bstr = '';
  for(i=0; i<tstr.length; i++){
      bstr += '&#' + tstr.charCodeAt(i) + ';';
  }
  return bstr;
}
