﻿// JScript File


var item;
var selectedTemplate;
var codePart1;
var lastservicefile;
var bg,border,txt;
    function showcode()
    {
      codeTable.style.display="block";
    }
    function showColorwindow(whatitem)
    {
      item=whatitem;
      colorwindow.style.display="block";
    }
    function hideColorwindow()
    {
      colorwindow.style.display="none";
    }
    function changecolor(newcolor)
    {
     if(item=='a')
     {
      colora.style.backgroundColor=newcolor;
      if(testTemplate.style.display=="block")
      {
       testTemplate.style.backgroundColor=colora.style.backgroundColor;
      }else
      {
       hTable.style.backgroundColor=colora.style.backgroundColor;
      }
      }
     if(item=='b')
     {
      colorb.style.backgroundColor=newcolor;
      if(testTemplate.style.display=="block")
      {
       testTemplate.style.borderColor=colorb.style.backgroundColor;
       testTemplateHead.style.borderBottomColor=colorb.style.backgroundColor;
      }else
      {
       hTable.style.borderColor=colorb.style.backgroundColor; 
      }
      }
     if(item=='c')
     {
      colorc.style.backgroundColor=newcolor;
      if(testTemplate.style.display=="block")
      {
       testTemplate.style.color=colorc.style.backgroundColor;
      }else
      {
       hTable.style.color=colorc.style.backgroundColor;      
      }
      }
      hideColorwindow();
      applyCodeOfTemptplate(13,lastservicefile);
    }
    function showhTable()
    {
      testTemplate.style.display="none";
      hTable.style.display="block";     
      applyCodeOfTemptplate(13,lastservicefile); 
      //aspnetForm.Radio13.click();
      aspnetForm.Radio13.checked=true;
      hTable.style.color=colorc.style.backgroundColor;
      hTable.style.borderColor=colorb.style.backgroundColor; 
      hTable.style.backgroundColor=colora.style.backgroundColor;

    }
    function showvTable()
    {    
      testTemplate.style.display="block";
      hTable.style.display="none";     
      applyCodeOfTemptplate(13,lastservicefile);
      aspnetForm.Radio13.checked=true;
      testTemplate.style.color=colorc.style.backgroundColor;
      testTemplate.style.borderColor=colorb.style.backgroundColor; 
      testTemplate.style.backgroundColor=colora.style.backgroundColor;
      testTemplateHead.style.borderBottomColor=colorb.style.backgroundColor;
    }
    function applyCodeOfTemptplate(tmp,servicefile)
    {
     codePart1='<!-- Begin WebdarWeb.com code --><script language="javascript" src="http://www.webdarweb.com/' + servicefile + '?';
     lastservicefile=servicefile;
     if(tmp==1)//ghaleb khakestari            
      aspnetForm.txtcode.value=codePart1 + 'w=157&bg=silver&border=dimgray&txt=black&type=v" ></script><!-- End WebdarWeb.com Code -->';            
     if(tmp==2)//ghaleb soorati            
      aspnetForm.txtcode.value=codePart1 + 'w=157&bg=pink&border=hotpink&txt=black&type=v" ></script><!-- End WebdarWeb.com Code -->';            
     if(tmp==3)//ghaleb abi            
      aspnetForm.txtcode.value=codePart1 + 'w=157&bg=a7e1ff&border=cornflowerblue&txt=black&type=v" ></script><!-- End WebdarWeb.com Code -->';            
     if(tmp==4)//ghaleb sabz            
      aspnetForm.txtcode.value=codePart1 + 'w=157&bg=greenyellow&border=green&txt=black&type=v" ></script><!-- End WebdarWeb.com Code -->';                             
     if(tmp==5)//ghaleb abi tire            
      aspnetForm.txtcode.value=codePart1 + 'w=157&bg=6699cc&border=gold&txt=black&type=v" ></script><!-- End WebdarWeb.com Code -->';            
     if(tmp==6)//ghaleb asemani            
      aspnetForm.txtcode.value=codePart1 + 'w=157&bg=aliceblue&border=green&txt=black&type=v" ></script><!-- End WebdarWeb.com Code -->';            
     if(tmp==7)//ghaleb khakestari            
      aspnetForm.txtcode.value=codePart1 + 'w=600&bg=silver&border=dimgray&txt=black&type=h" ></script><!-- End WebdarWeb.com Code -->';            
     if(tmp==8)//ghaleb khakestari            
      aspnetForm.txtcode.value=codePart1 + 'w=600&bg=6699cc&border=gold&txt=black&type=h" ></script><!-- End WebdarWeb.com Code -->';            
     if(tmp==9)//ghaleb khakestari            
      aspnetForm.txtcode.value=codePart1 + 'w=600&bg=a7e1ff&border=cornflowerblue&txt=black&type=h" ></script><!-- End WebdarWeb.com Code -->';            
     if(tmp==10)//ghaleb khakestari            
      aspnetForm.txtcode.value=codePart1 + 'w=600&bg=pink&border=hotpink&txt=black&type=h" ></script><!-- End WebdarWeb.com Code -->';                                                
     if(tmp==11)//ghaleb khakestari            
      aspnetForm.txtcode.value=codePart1 + 'w=600&bg=greenyellow&border=green&txt=black&type=h" ></script><!-- End WebdarWeb.com Code -->';            
     if(tmp==12)//ghaleb khakestari            
      aspnetForm.txtcode.value=codePart1 + 'w=600&bg=aliceblue&border=green&txt=black&type=h" ></script><!-- End WebdarWeb.com Code -->';                        
     if(tmp==13)//ghaleb delkhah      
     {
        if(colora.style.backgroundColor.substring(0,1)=='#')
         bg=colora.style.backgroundColor.substring(1,7) ;
        else
         bg=colora.style.backgroundColor;    
        if(colorb.style.backgroundColor.substring(0,1)=='#')
         border=colorb.style.backgroundColor.substring(1,7) ;
        else
         border=colorb.style.backgroundColor; 
        if(colorc.style.backgroundColor.substring(0,1)=='#')
         txt=colorc.style.backgroundColor.substring(1,7) ;
        else
         txt=colorc.style.backgroundColor;  
      if(testTemplate.style.display=="block")
      {                        
        aspnetForm.txtcode.value=codePart1 + 'w=157&bg='+bg+'&border='+ border+'&txt='+ txt +'&type=v" ></script><!-- End WebdarWeb.com code -->';                                      
      }  
      else      
        aspnetForm.txtcode.value=codePart1 + 'w=600&bg='+bg+'&border='+ border +'&txt='+ txt +'&type=h" ></script><!-- End WebdarWeb.com code -->';                                    
     }
    }
