﻿ google.load("language", "1"); 
    var st_l="en";
   function initialize(st) { 
      var text = document.getElementById(st).innerHTML; 
      google.language.detect(text, function(result) { 
        if (!result.error && result.language) { 
          google.language.translate(text,result.language,st_l, 
                                    function(result) { 
            var translated = document.getElementById(st); 
            if (result.translation) { 
              translated.innerHTML = result.translation; 
              } 
          }); 
        } 
      }); 
    } 
    
  
function class_product()
{
        var prodcut_object=document.getElementById("product_div").getElementsByTagName("a");
      
         for(var cc=0;cc< prodcut_object.length;cc++)
         {
        
             var ded=prodcut_object [cc];
             if(ded.name=="product_a")
             {
               initialize(ded.id);
             }
        }
        foot_product();
 }
 
 function foot_product()
 {
        var prodcut_object=document.getElementById("foot_div").getElementsByTagName("a");
      
         for(var cc=0;cc< prodcut_object.length;cc++)
         {
        
             var ded=prodcut_object [cc];
             if(ded.name=="product_a")
             {
               initialize(ded.id);
             }
        }
 }
 
 function initialize_content(st,str) { 
   
    //  var text = document.getElementById(st).innerHTML; 
      var text = str; 
      google.language.detect(text, function(result) { 
        if (!result.error && result.language) { 
          google.language.translate(text,result.language,st_l, 
                                    function(result) { 
            var translated = document.getElementById(st); 
            if (result.translation) { 
              translated.innerHTML += result.translation; 
              } 
          }); 
        } 
      }); 
    } 
    
    function product_content_div()
    {
          var str_content=document.getElementById("Product_Description_content").innerHTML;
          document.getElementById("Product_Description_content").innerHTML="";
          var str_content_array=str_content.split('.');
          for(var i=0;i<str_content_array.length;i++)
          { 
             var str_txt=str_content_array[i];
              if (str_txt.length<300)
              {
                 initialize_content("Product_Description_content",str_txt);
              }
             else
             {
                var zai_txt =str_txt.split(',')
                for(var zi=0;zi<zai_txt.length;zi++)
                {
                   var str_txt_t=zai_txt[zi];
                   initialize_content("Product_Description_content",str_txt_t);
                } 
             
             }
                
          } 
         // product_Review();
          class_product();
          product_name_hi();
          //product_name_op;
     }
    
    
   function product_Review_div(str)
    {
          var str_content=document.getElementById(str).innerHTML;
          document.getElementById(str).innerHTML="";
          var str_content_array=str_content.split('.');
          for(var i=0;i<str_content_array.length;i++)
          { 
             var str_txt=str_content_array[i];
              if (str_txt.length<300)
              {
                 initialize_content(str,str_txt);
              }
             else
             {
                var zai_txt =str_txt.split(',')
                for(var zi=0;zi<zai_txt.length;zi++)
                {
                   var str_txt_t=zai_txt[zi];
                   initialize_content(str,str_txt_t);
                } 
             
             }
                
          } 
     }  
     
     
 
    
    function product_Review()
    {
    	  var prodcut_object=document.getElementById("Product_Description_content").getElementsByTagName("p");
      
         for(var cc=0;cc< prodcut_object.length;cc++)
         {
        
             var ded=prodcut_object [cc];
             if(ded.name=="product_p")
             {
               product_Review_div(ded.id);
             }
         }
    }
 
 
 
    function product_name_hi()
    {
     
    	initialize("product_name");
    	initialize("product_name2");
    }
    
    function product_name_op()
    {
    // options_p
       	  var prodcut_object=document.getElementById("options_p").getElementsByTagName("option");
      
         for(var cc=0;cc< prodcut_object.length;cc++)
         {
        
             var ded=prodcut_object [cc];
             if(ded.name=="Product_option_o")
             {
               initialize(ded.id);
             }
         }
    	//initialize("product_name");
    }
    
    
    
  function help_detial_ln()
    {
    	initialize("help_title");
     	
    	 var str_content=document.getElementById("help_detail_div").innerHTML;
          document.getElementById("help_detail_div").innerHTML="";
          var str_content_array=str_content.split('.');
          for(var i=0;i<str_content_array.length;i++)
          { 
             var str_txt=str_content_array[i];
              if (str_txt.length<300)
              {
                 initialize_content("help_detail_div",str_txt);
              }
             else
             {
                var zai_txt =str_txt.split(',')
                for(var zi=0;zi<zai_txt.length;zi++)
                {
                   var str_txt_t=zai_txt[zi];
                   initialize_content("help_detail_div",str_txt_t);
                } 
             
             }
                
          } 
    	
     	 class_product();
    }
    
    
    
 
    
        function order_send_lan()
    {
  
        var txt_object=document.getElementById("order_div_content").getElementsByTagName("div");
          for(var cc=0;cc< txt_object.length;cc++)
         {
        
             var ded=txt_object[cc];
             if(ded.name=="Paymethod_span")
             {
               product_Review_div(ded.id);
             }
         }
      class_product();    
  }
   
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
 
