﻿
try  {  document.domain='vsvt.com';  }
catch(err) {} 


function $(element) {
  if (typeof element == 'string')
    element = document.getElementById(element);
  return element;
}


var currTId = null;
var currDId = null;
function mouseOver(obj,tag0,tag1,id)
{

if( currTId!=null)
{
 if($(currTId)) $(currTId).style.display="block";
 if($(currDId)) $(currDId).style.display="none";	   
}	

var Tid = tag0 + id;
var Did = tag1 + id;

if($(Tid)) $(Tid).style.display="none";	   
if($(Did)) $(Did).style.display="block";	  

currTId = Tid;
currDId = Did;


}


function openWin(url,name,w,h)
 {
    var x=(window.screen.width-w)/2;
	var y=(window.screen.height-h)/2;
	var win=window.open(url,name,'toolbar=0,location=0,status=0,top='+y+',left='+x+',width='+w+',height='+h );
	win.focus();
	
	return win;
 }
function openSuitWin(url,name)
 {
	var sw=window.screen.width;
	var sh=window.screen.height;
	var w=sw-300;
	var h=sh-300;
	var x=(sw-w)/2;
	var y=0;
	var win=window.open(url,name,'toolbar=0,scrollbars=1,location=1,menubar=1,resizable=1,status=1,top='+y+',left='+x+',width='+w+',height='+h );
	win.focus();
 }
 
 var last_img_btn_chg_prd=null;
 
function ImgBtnChgPrd_Mouseover(obj,mainpictureurl,largepictureurl)
 {

    if(last_img_btn_chg_prd!=null) 
        last_img_btn_chg_prd.className='img_btn_chg_prd';
    last_img_btn_chg_prd=obj;
    obj.className='img_btn_chg_prd_active';
    
    

    document.getElementById('img_show_prd').src=mainpictureurl;
	document.getElementById('img_show_prd').onclick=function(){ImgBtnChgPrd_Click(this,largepictureurl);}
	document.getElementById('spn_tobig').onclick=function(){ImgBtnChgPrd_Click(this,largepictureurl);}
	
 }

function ImgBtnChgPrd_Click(obj,largepictureurl)
 {
    document.getElementById('hid_largepictureurl').value=largepictureurl;
	var win=openWin('Product.asp','preview',700,580);
	win.opener=this;
 }

function suitImage(img,w,h)
{
		var image=new Image();
        image.src=img.src;

		var iw=image.width;
		var ih=image.height;
		var iratio=iw/ih;
        
        if(iw>w)
		{
                iw=w;
				ih=w/iratio;
        }
        if(ih>h)
		{
                ih=h;
                iw=h*iratio;
        }  
		img.width=iw;
		img.height=ih;
}



function set_review_summary(product_type,total_review_count,total_question_count)
{
    
      var str_total_count= product_type=='UnKnow'?total_question_count:total_review_count;
    if(str_total_count>'0')
    {
        var reviewTag = document.getElementById("review_summary");
        var revTag = document.getElementById("spn_rev_cnt");
        
        if(reviewTag)reviewTag.style.display='inline';
        if(revTag) revTag.innerHTML=str_total_count;
    }
}




window.onerror=function()
{
	return true;
}



function getposOffset(what, offsettype)
{ 
    var totaloffset=(offsettype=="left")? what.offsetLeft : what.offsetTop; 
    var parentEl=what.offsetParent; 
    while (parentEl!=null)
    { 
        totaloffset=(offsettype=="left")? totaloffset+parentEl.offsetLeft : totaloffset+parentEl.offsetTop; 
         parentEl=parentEl.offsetParent; 
    } 
    return totaloffset; 
} 

function showLocSelect(objid,divId,x_offset,y_offset)
{
	
	var locdiv=document.getElementById(divId);
	var obj=document.getElementById(objid);
	
    locdiv.style.top=(getposOffset(obj,"top")-y_offset)+"px";
	locdiv.style.left=(getposOffset(obj,"left")-x_offset)+"px";
	locdiv.style.display="block";
}

function hideLocSelect(divId)
{	
	document.getElementById(divId).style.display="none";
}


function key_link(cat,key,mode)
{
    var click_name = null;
    
    if(mode == "new")
    {
     click_name = new_click_99_name;
    }
    else
    {
      click_name = click_99_name;
    }
    var normal_html= "";
	var link =cat_link[cat] + escape(key);
	var link_name=click_name[cat];
	var rep_id=li_ids[cat];
	var link_html="<a  class='blue12a'  href='"+link+"' name='"+link_name+"' target='_blank'>"+key+"</a>";
	if(document.getElementById(rep_id))normal_html = document.getElementById(rep_id).innerHTML;	
	if(document.getElementById(rep_id)) document.getElementById(rep_id).innerHTML=normal_html.replace(key,link_html);
}