﻿function setWidth()
{

    var _loc = location.href;
    var _ietitle ='';
    
        var as = document.getElementsByTagName("a");
        var _aL = as.length;
        
        while(_aL){
            var _aitem = as[--_aL];
            if(_aitem.className=="amain")
            {
               var _newName= _aitem.parentNode.className+' active';
               
               if(_aitem.href==_loc){
                   if(navigator.appName=="Microsoft Internet Explorer")
	      	 {
                      _aitem.parentNode.setAttribute('className',_newName);
                   }else{
                      _aitem.parentNode.setAttribute('class',_newName);
                   } 
               }
            } 
       } 
   

    if(document.getElementById('img-current_picture')!=null)  
    {
      var allImg = document.getElementById('img-current_picture');

	if (allImg.width > 184)
        {
            allImg.height = allImg.height*(184/allImg.width);
            allImg.width = 184;
        }
        if (allImg.height > 184)
        {
            allImg.width = allImg.width*(184/allImg.height);
            allImg.height = 184;
        }  
         
      

    }


    if(!document.getElementsByClassName){
 
    var imgs = document.getElementsByTagName("img");
    var L = imgs.length;
    var _dothumbpic = false;

    while(L){
      var iitem = imgs[--L];
      var _width;
      var _doIt = false;
      
      switch(iitem.className)
      {
          case "thumbpic":
          {
             _width = 184;
             _doIt = true; 
             _dothumbpic = true;
             
          }
          break; 
          case "imghit":
             _width = 50;
             _doIt = true; 
          break; 
          case "prdbt":
             _width = 181;
             _doIt = true; 
          break; 
          case "imgsize":
             _width = 190;
             _doIt = true; 
          break;
      }
      
      if(_doIt){  
      
        if (iitem.width > _width)
        {
            iitem.height = iitem.height*(_width/iitem.width);
            iitem.width = _width;
        }
        if (iitem.height > _width)
        {
            iitem.width = iitem.width*(_width/iitem.height);
            iitem.height = _width;
        }
      } 
}
       var divs = document.getElementsByTagName("div");
             var divL = divs.length;
             while(divL)
             {
                 var divitem=divs[--divL];
                 if(divitem.className=="cpt_product_description "){
                    if(_dothumbpic){
                     divitem.setAttribute('className','cpt_product_description_ie_large');
                 }else{
                     divitem.setAttribute('className','cpt_product_description_ie');
                 }
                 }
             }


     

}else{
    

 
    if(document.getElementsByClassName('thumbpic'))
    {  

       var allThumbImg = document.getElementsByClassName('thumbpic');

   

    if(allThumbImg.length!=0){
        var a = document.getElementsByClassName('cpt_product_description');
        a[0].style.minHeight="148px";
      }


     for(i=0;i<allThumbImg.length;i++)
     {
        if (allThumbImg[i].width > 184)
        {
            allThumbImg[i].height = allThumbImg[i].height*(184/allThumbImg[i].width);
            allThumbImg[i].width = 184;
        }
        if (allThumbImg[i].height > 184)
        {
            allThumbImg[i].width = allThumbImg[i].width*(184/allThumbImg[i].height);
            allThumbImg[i].height = 184;
        }

     }

    }
     
    
 

    if(document.getElementsByClassName("imghit")!=null){

    var imghit = document.getElementsByClassName("imghit");


    for(k=0;k<imghit.length;k++)
     {
        if (imghit[k].width > 51)
        {
            imghit[k].height = imghit[k].height*(51/imghit[k].width);
            imghit[k].width = 51;
        }
        if (imghit[k].height > 51)
        {
            imghit[k].width = imghit[k].width*(51/imghit[k].height);
            imghit[k].height = 51;
        }

     }
}

if(document.getElementsByClassName('prdbt')!=null){

  var pr = document.getElementsByClassName('prdbt');

   

    for(j=0;j<pr.length;j++)
     {
        if (pr[j].width > 181)
        {
            pr[j].height = pr[j].height*(181/pr[j].width);
            pr[j].width = 181;
        }
        if (pr[j].height > 181)
        {
            pr[j].width = pr[j].width*(181/pr[j].height);
            pr[j].height = 181;
        }

     }


} 

if(document.getElementsByClassName('imgsize')!=null){
  var isi = document.getElementsByClassName('imgsize');

   

    for(isii=0;isii<isi.length;isii++)
     {
        if (isi[isii].width > 190)
        {
            isi[isii].height = isi[isii].height*(190/isi[isii].width);
            isi[isii].width = 190;
        }
        if (isi[isii].height > 190)
        {
            isi[isii].width = isi[isii].width*(190/isi[isii].height);
            isi[isii].height = 190;
        }

     }


} 

 
}
    
}
onload = setWidth;
