// JavaScript Document
function show_pics(picurl)
{
	var image=new Image(); 
 	image.src=document.getElementById('pics').src;
	var w = 295;
	var h = 365;
	if(image.width>w){ 
		flag=true;
		document.getElementById('pics').width=w;
		h=document.getElementById('pics').width
		if(image.height>h){ 
			document.getElementById('pics').height=h;
		}else{
			document.getElementById('pics').width=w;}
	}else if(image.height>h){ 
		flag=true;
		document.getElementById('pics').height=h;
		document.getElementById('pics').width=295/365*h;
	}
	document.getElementById('pics').src =picurl;
	document.getElementById('pics1').href =picurl;
}
function hiddenmsg(){
	if (document.getElementById('hiddenmsg').style.display == 'none')
		{
			document.getElementById('hiddenmsg').style.display="block";
			document.getElementById('keqq').src ="/images/mingle/sertop.gif";
		}
		else
		{
			document.getElementById('hiddenmsg').style.display="none";
			document.getElementById('keqq').src ="/images/mingle/sertop_close.gif";
		}
}
function show_s(id)
{

	if (document.getElementById('u'+id).style.display == 'none')
		{
			document.getElementById('u'+id).style.display="block";
		}
		else
		{
			document.getElementById('u'+id).style.display="none";
		}
}
function searchAth()
{
  var ath = document.getElementById("words").value;
  if(ath!=null&&ath!=""&&ath!="产品搜索")
  {
					 
		document.searchBox.action='/searchResults.asp';  
		document.searchBox.submit();


  }

}
function searchAth_e()
{
  var ath = document.getElementById("words").value;
  if(ath!=null&&ath!=""&&ath!="Search")
  {
					 
		document.searchBox.action='/searchResults-e.asp';  
		document.searchBox.submit();


  }

}
function checkmyform()
{
   if(checkspace(document.myform.username.value)) {
	document.myform.username.focus();
    alert("对不起，网站名称不能为空！");
	return false;
  }

     if(checkspace(document.myform.email.value)) {
	document.myform.email.focus();
    alert("对不起，Email不能为空！");
	return false;
  }
  if(document.myform.contents.value=='http://') {
	document.myform.contents.focus();
    alert("对不起，网站留言内容不能为空！");
	return false;
  }
}
function checkmyform1()
{
   if(checkspace(document.myform.linkname.value)) {
	document.myform.linkname.focus();
    alert("Sorry,the website name can not be empty!");
	return false;
  }

     if(checkspace(document.myform.linkurl.value)) {
	document.myform.linkurl.focus();
    alert("Sorry,the website can not be empty!");
	return false;
  }
  if(document.myform.linkurl.value=='http://') {
	document.myform.linkurl.focus();
    alert("Sorry,the website can not be empty!");
	return false;
  }
   if(checkspace(document.myform.linkdesc.value)) {
	document.myform.linkdesc.focus();
    alert("Sorry,the website profile can not be empty!");
	return false;
  }

}

function checkspace(checkstr) {
  var str = '';
  for(i = 0; i < checkstr.length; i++) {
    str = str + ' ';
  }
  return (str == checkstr);
}

var flag=false; 
function DrawImage(ImgD){ 
 var image=new Image(); 
 image.src=ImgD.src; 
 if(image.width>0 && image.height>0){ 
  flag=true; 
   if(image.width > 295){
	 if((image.height*295)/image.width>365)
	 {
		ImgD.width=(image.width*365)/image.height; 
		ImgD.height=365; 
	 }
	 else
	 {
		ImgD.width=295; 
		ImgD.height=(image.height*295)/image.width; 
	 }
   }
   else
   { 
   	if(image.height > 365)
	 {
		ImgD.width=(image.width*365)/image.height; 
		ImgD.height=365; 
	 }else{
		ImgD.width=image.width;
		ImgD.height=image.height; 
	 }
   } 
  }
}

function MM_jumpMenu(targ,selObj,restore){ //v3.0
  eval(targ+".location='"+selObj.options[selObj.selectedIndex].value+"'");
  if (restore) selObj.selectedIndex=0;
}
function sethome()
{
	 if (document.all){   
		document.body.style.behavior='url(#default#homepage)';   
		document.body.setHomePage(document.URL);   
	  }else if (window.sidebar){   
			if(window.netscape){   
		   try{    
			  netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect");    
		   }catch (e){    
						alert( "该操作被浏览器拒绝，如果想启用该功能，请在地址栏内输入 about:config,然后将项 signed.applets.codebase_principal_support 值该为true" );    
		  }   
		   }    
		var prefs = Components.classes['@mozilla.org/preferences-service;1'].getService(Components. interfaces.nsIPrefBranch);   
		prefs.setCharPref('browser.startup.homepage',document.URL);   
	   }   
}
function addbookmark()
{
    var nome_sito = "一比一lv名品专卖店";
    var url_sito = "http://www.ybylv.com";
    if ((navigator.appName == "Microsoft Internet Explorer") && (parseInt
        (navigator.appVersion) >= 4))
        window.external.AddFavorite(url_sito, nome_sito);
    else if (navigator.appName == "Netscape")
        window.sidebar.addPanel(nome_sito, url_sito, '');
    else
        alert("Sorry!Cann't Add this site to your favorite!.");
}
function addCookie(pageURL,pageNAME)  
{  
if (document.all)  
    {  
       window.external.addFavorite(pageURL,pageNAME);  
    }  
    else if (window.sidebar)  
    {  
       window.sidebar.addPanel(pageNAME, pageURL, "");  
}  
}  
function setHomepage(pageURL)  
{  
if (document.all)  
    {  
        document.body.style.behavior='url(#default#homepage)';  
  document.body.setHomePage(pageURL);  
   
    }  
    else if (window.sidebar)  
    {  
    if(window.netscape)  
    {  
         try  
   {    
            netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect");    
         }    
         catch (e)    
         {    
    alert( "该操作被浏览器拒绝，如果想启用该功能，请在地址栏内输入 about:config,然后将项 signed.applets.codebase_principal_support 值该为true" );    
         }  
    }   
    var prefs = Components.classes['@mozilla.org/preferences-service;1'].getService(Components. interfaces.nsIPrefBranch);  
    prefs.setCharPref('browser.startup.homepage',pageURL);  
}  
}  
function $(element){
	if(document.getElementById && document.getElementById(element)) { 
	return document.getElementById(element); 
	} 
	else if (document.all && document.all(element)) { 
	return document.all(element); 
	} 
	else if (document.layers && document.layers[element]) { 
	return document.layers[element]; 
	} 
	else { 
	return false; 
	} 
}
var lock = false;
function $D(id,counts){
	var d=$(id);
	var w=d.offsetHeight;
	var maxw=28*Number(counts);
	function dmove(){
		w+=30; //设置层展开的速度
		if(w>=maxw){
			lock = false;
			//d.style.height='30px';
			clearInterval(IntervalId);
			d.style.overflow='';
			//window.status = "b"+G_ID;
		}else{
			lock=true;
			d.style.display='block';
			d.style.height=w+'px';
			IntervalId=window.setTimeout(dmove,2);
		}
	}
	IntervalId=window.setTimeout(dmove,2);
}

function $D2(id){
	var d=$(id);
	var w=d.offsetHeight;
	var maxw=80;
	function dmove1(){
		w-=60;//设置层收缩的速度
		if(w<=0){
			lock = false;
			d.style.display='none';
			clearInterval(iIntervalId);
			//window.status = "c"+G_ID;
		}else{
			lock = true;
			d.style.height=w+'px';
			d.style.overflow='hidden';
			setTimeout(dmove1,2);
		}
	}
	iIntervalId=setTimeout(dmove1,2);
}


function $use(id,counts,count1){
	var d=$('u' + id);
	var nh=$('nh' + id);
	if(lock)return;
	//window.status = "a"+G_ID;
	if(d.style.display=='none'){
		for(i = 1; i < counts + 1; i++) {
			if (id !=i){
				$D2('u' + i);
			}
		}
		$D('u' + id,count1);
	}else{
		for(i = 1; i < counts + 1; i++) {
			$D2('u' + i);
		}
	}
}
function externalLinks(){
if (!document.getElementsByTagName) return;
var anchors = document.getElementsByTagName("a");
for (var i=0; i<anchors.length; i++){
var anchor = anchors[i];
if (anchor.getAttribute("href") &&
anchor.getAttribute("rel") == "external")
anchor.target = "_blank";
}
}
window.onload = externalLinks;