﻿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/image.height>= 105/80){ 
   if(image.width>105){
    ImgD.width=105; 
    ImgD.height=(image.height*105)/image.width; 
   }else{ 
    ImgD.width=image.width;
    ImgD.height=image.height; 
   } 
  } 
  else{ 
   if(image.height>80){
    ImgD.height=80; 
    ImgD.width=(image.width*80)/image.height; 
   }else{ 
    ImgD.width=image.width;
    ImgD.height=image.height; 
   } 
  } 
 }
}
function OpenAffiche(aid)
{
    window.open('ShowGG.aspx?AfficheID='+aid, 'newwindow', 'height=450, width=400, toolbar=no, menubar=no, scrollbars=yes, resizable=no, location=no, status=no');
}
function Search()
{
    var txtkey = document.getElementById("txtKeyword");
    if(txtkey.value=="")
    {
        alert("请您输入搜索关键字");
        txtkey.focus();
        return;
    }
    var v = $("#ddCategory").val();
    var key = escape(txtkey.value);
    var url="";
    if(v=="2")
    {
        url="SearchProduct.aspx?Keyword="+key;
    }
    else if(v=="1")
    {
        url="SearchContent.aspx?Keyword="+key;
    }
    window.open(url);
}
function SearchInfo() {
    var txtkey = document.getElementById("txtKeyword");
    if (txtkey.value == "") {
        alert("请您输入搜索关键字");
        txtkey.focus();
        return;
    }
    var v = $("#ddCategory").val();
    var t = $("#ddTime").val();
    var key = escape(txtkey.value);
    var url = "";
    if (v == "2") {
        url = "SearchProduct.aspx?Keyword=" + key+"&t="+t;
    }
    else if (v == "1") {
        url = "SearchContent.aspx?Keyword=" + key+"&t="+t;
    }
    window.open(url);
}
function Register() {
    window.open("register.aspx");
}
function QuestionPrice()
{
    var productIDs="";
    var cbs = document.getElementsByName("cbSelect");
    for(i=0;i<cbs.length;i++)
    {
        if(cbs[i].checked)
        {
            productIDs=productIDs+cbs[i].productid+",";
        }
    }
    if(productIDs=="")
    {
        alert("请选择要询价的产品");
        return false;
    }
    document.getElementById("ctl00_PageBody_Products").value=productIDs;
}
function SetProducts()
{
    var productIDs="";
    var cbs = document.getElementsByName("cbSelect");
    for(i=0;i<cbs.length;i++)
    {
        if(cbs[i].checked)
        {
            productIDs=productIDs+cbs[i].productid+",";
        }
    }
    if(productIDs=="")
    {
        alert("请选择要询价的产品");
        return false;
    }
    document.getElementById("ctl00_PageBody_ProductIDs").value=productIDs;
    return true;
}
function UserLogin()
{
    var txtUserName=$("#txtUserName");
    var txtUserPassword=$("#txtUserPassword");
    if(txtUserName.val()=="")
    {
        alert("请输入用户名");
        txtUserName.focus();
        return false;
    }
    if(txtUserPassword.val()=="")
    {
        alert("请输入密码");
        txtUserPassword.focus();
        return false;
    }
    return true;
}
function userLogout()
{
    if(confirm('您确定要退出吗？'))
    {
        window.location='logout.aspx';
    }
}

