/*************************************
 * 
 * alex changed on 2009-11-2 14:46:00
 * 
 ************************************/

$(function(){
	//$("#button").DMenu("#content");
	show_comment();
	show_seller();
	show_photo();
});


function flash(ur,w,h){ 
document.write('<object classid="clsid:D27CDB6E-AE6D-11CF-96B8-444553540000" id="obj1" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,40,0" border="0" width="'+w+'" height="'+h+'">'); 
document.write('<param name="movie" value="'+ur+'">'); 
document.write('<param name="quality" value="high"> '); 
document.write('<param name="wmode" value="transparent"> '); 
document.write('<param name="menu" value="false"> '); 
document.write('<embed src="'+ur+'" pluginspage="http://www.macromedia.com/go/getflashplayer" type="application/x-shockwave-flash" name="obj1" width="'+w+'" height="'+h+'" quality="High" wmode="transparent">'); 
document.write('</embed>'); 
document.write('</object>'); 
} 

function setTab(m,n){
var tli=document.getElementById("tag").getElementsByTagName("div");
var mli=document.getElementById("tag_content").getElementsByTagName("div");
for(i=0; i<tli.length; i++){
tli[i].className=i==n?"main_tag_in":"main_tag_out";
mli[i].style.display=i==n?"block":"none";
}

}
function setRate(m,n){
var tli=document.getElementById("rateclass").getElementsByTagName("span");
for(i=0; i<tli.length; i++){
document.getElementById("rateclass"+i).className=i==n?"in_item":"out_item";
document.getElementById("rate_content"+i).style.display=i==n?"block":"none";
   if(n ==1){
   var pro_Id = document.getElementById("pID").value;
    custom_review (pro_Id,0)
  }
}
}

function setshowTab(m,n){
var tli=document.getElementById("tag").getElementsByTagName("li");
var mli=document.getElementById("tag_content").getElementsByTagName("div");
for(i=0;i<tli.length;i++){
    if(typeof(tli[i])=="object"){
        tli[i].className=i==n?"show_tag_choose":"show_tag_nochoose";
        mli[i].style.display=i==n?"block":"none";
    }
     if(n==0)
   {
      special();
   }
   else if(n==1)
   {
    // photos();
   }
   else if (n==2)
   {
    // Custom_Photo ();
   }
   else if(n==3)
   {
     Videos ();
   }
  
}

  
 
}

function sethelpTab(n){
var tli=document.getElementById("tag").getElementsByTagName("span");
for(i=0;i<tli.length-1;i++){
document.getElementById("tag"+i).className=i==n?"help_list_close":"help_list_open";
document.getElementById("tag_content"+i).style.display=i==n?"block":"none";
}
}

function show_comment(){$("#seller_rec"+" li").each(function(c){$(this).mouseover(function(){$("#r"+"_"+c).toggle()}).mouseout(function(){$("#r"+"_"+c).toggle()})})
}

function show_seller(){$(".main_seller_content"+" a img").each(function(c){$(this).mouseover(function(){$("#seller"+"_"+c).slideDown('fast')}).mouseout(function(){$("#seller"+"_"+c).slideUp('fast')})})
}

function show_photo(){$(".acc_upphoto img:even").each(function(c){$(this).mouseover(function(){$("#pimg"+"_"+c).show('fast')}).mouseout(function(){$("#pimg"+"_"+c).hide('fast')})})
$(".acc_upphoto div a").each(function(){$(this).click(function(){$("#upload_pic").show();})})
}

function setRating(ratingBar,rate)
    {
        document.getElementById(ratingBar).style.width = rate * 15+"px";
        //document.frmProductReview.txtNumOfStar.value=rate;
    }
    
    
    
  function  special()
   {
  var pro_Id = document.getElementById("pID").value;
  url ="/deal_spcv.aspx";
 var data ="prodcutID="+pro_Id+"&flg=func";
             $.ajax({ 
     type:"POST", 
     url: url,
     data:data ,
     beforeSend: function(XMLHttpRequest){ 
           $("#tag_content0").html("&nbsp;&nbsp;<img src=/img/ajax.gif />");
        },
     success:function(Message){  
         //$("#addrsend").html(ts);
         if(Message != "FAIL")
         {
            //alert(Message);
            // document.write(Message);
            $("#tag_content0").html(Message);
         }
         //alert(document.getElementById("addrsend").innerHTML)
        }, 
     error:function(){
           //  alert("network error");
                }
           });
        
        
      
      }
      
      
      function photos()
      {
      var pro_Id = document.getElementById("pID").value;
      url ="/deal_spcv.aspx";
     // <div id="tag_content1" style="display:none;" class="show_content_pic"><a id="photo"  name="photo"></a></div>
      var data ="prodcutID="+pro_Id+"&flg=pho";
         $.ajax({ 
     type:"POST", 
     url: url,
     data:data,
	 //timeout:2,
     beforeSend: function(XMLHttpRequest){ 
           $("#tag_content1").html("&nbsp;&nbsp;<img src=/img/ajax.gif />");
        },
     success:function(Message){  
         //$("#addrsend").html(ts);
         if(Message != "FAIL")
         {
           // alert(Message);
            //document.write("<div id='tag_content1' style='display:none;' class='show_content_pic'><a id='photo'  name='photo'>"+Message+"</a>");
            //document.write(Message);
             $("#tag_content1").html(Message);
         }
         //alert(document.getElementById("addrsend").innerHTML)
        }, 
     error:function(){
           //  alert("network error");
                }
           });
    }
    
    
    
    //display Customer Photo 
  function  Custom_Photo ()
    { 
    var pro_Id = document.getElementById("pID").value;
    url ="/deal_spcv.aspx";
    var data ="prodcutID="+pro_Id+"&flg=cuspho";
    //
          $.ajax({ 
     type:"POST", 
     url: url,
     data:data ,
     beforeSend: function(XMLHttpRequest){ 
           $("#tag_content2").html("&nbsp;&nbsp;<img src=/img/ajax.gif />");
        },
     success:function(Message){  
         //$("#addrsend").html(ts);
         if(Message != "FAIL")
         {
            // document.write("<div id='tag_content2' style='display:none;' class='show_content_text'>"+Message+"</div>");
            //document.write(Message);
            $("#tag_content2").html(Message);
         }
         //alert(document.getElementById("addrsend").innerHTML)
        }, 
     error:function(){
           //  alert("network error");
                }
           }); 
    
    }
    
  
  //display Video  
   function Videos ()
    {
    var pro_Id = document.getElementById("pID").value;
    url ="/deal_spcv.aspx";
      var data ="prodcutID="+pro_Id+"&flg=vide";
    //
       $.ajax({ 
     type:"POST", 
     url: url,
     data:data ,
     beforeSend: function(XMLHttpRequest){ 
           $("#tag_content3").html("&nbsp;&nbsp;<img src=/img/ajax.gif />");
        },
     success:function(Message){  
         //$("#addrsend").html(ts);
         if(Message != "FAIL")
         {
            //document.write("<div id='tag_content3' style='display:none;' class='show_content_text'>"+Message+"</div>");
            //  document.write(Message);
              $("#tag_content3").html(Message);
         }
         //alert(document.getElementById("addrsend").innerHTML)
        }, 
     error:function(){
           //  alert("network error");
                }
           });
    }

      
      
    
     function custom_review () 
      {
       var pro_Id = document.getElementById("pID").value;
    url ="/show_reviews.aspx";
      var data ="prodcutID="+pro_Id+"&flg=showrevies";
    //
   //   alert(data);
       $.ajax({ 
     type:"POST", 
     url: url,
     data:data ,
     beforeSend: function(XMLHttpRequest){ 
          
        },
     success:function(Message){  
         //$("#addrsend").html(ts);
         if(Message != "FAIL")
         {
          //    alert("yyy");
              $("#rate_content1").html(Message);
         }else
         {
          // alert("nnoo")
         }
         
        }, 
     error:function(){
           //  alert("network error");
                }
           });
    
    
    }
    
    
     function custom_review (pro_Id,Page) 
      {
      var url ="/show_reviews.aspx";
      var data ="pid="+pro_Id+"&page="+Page+"&action=feed";
       $.ajax({ 
     type:"POST", 
     url: url,
     data:data ,
     beforeSend: function(XMLHttpRequest){ 
         $("#rate_content1").html("&nbsp;&nbsp;<img src=/img/ajax.gif />"); 
        },
     success:function(Message){  
         //$("#addrsend").html(ts);
         if(Message != "FAIL")
         {
           //    alert("yyy");
              $("#rate_content1").html(Message);
         }else
         {
          // alert("nnoo")
         }
         
        }, 
     error:function(){
          //   alert("network error");
                }
           });
    
    
    }
    
	    function displaySubMenu() {
            document.getElementById("subMenu").style.display = "block";
        }

        function hideSubMenu() {
            document.getElementById("subMenu").style.display = "none";
        }
