//提交搜索
function submitSearch(strDomain,domain)
{
    var siteDomain="http://www."+strDomain+"/";
    var curOption=document.getElementById("selectOp").value;
    var qstr=document.getElementById("qstr").value;
    
    switch(curOption)
    {
        case "spec":
            window.open("http://search.wiseman.tv/sse/expertSearchResults.aspx?qstr="+qstr,"_blank");
            break;
		case "products":
		    if(document.getElementById("shopout").checked) //店外搜索
			{
				window.open("http://search.wiseman.tv/aisearch/search.aspx?qstr="+qstr,"_blank");
			}
			else
			{
				window.open("searchresult.aspx?pType=products&jykey="+escape(qstr),"_self");
			}
			break;
		case "web":
			window.open("http://search.wiseman.tv/sse/wangye.aspx?qstr="+qstr,"_blank");
			break;
		case "news":
			window.open("http://search.wiseman.tv/sse/NewsSearchResults.aspx?qstr="+qstr,"_blank");
			break;
     }
}  



/*首页操作的部分JS*/

//判断是否支持积分消费
function IsIntegral(isIntegral)
{
    if(isIntegral==true)
    {
        return "(支持积分消费)";
    }
    else
    {
        return "";
    }
}

//判断是否支持积分消费
function IsVideoIntegral(isIntegral)
{
    if(isIntegral==true)
    {
        return "<span style=\"float:left; padding-right:5px;\" class=\"hand_tag\" title=\"支持积分消费\"></span>";
    }
    else
    {
        return "<span style='float:left;'></span>";
    }
}

//全部产品中判断产品类型 如:0表示文章,1表示视频,2表示音频,3表示问答
function typeImage(isType)
{
    if(isType=="0")
    {
        return "<div class=\"ico_text\"></div>";
    }
    else if(isType=="1")
    {
        return "<div class=\"ico_video\"></div>";
    }
    else if(isType=="2")
    {
        return "<div class=\"ico_audio\"></div>";
    }
    else
    {
        return "<div class=\"ico_question\"></div>";
    }
}

//全部产品中判断产品类型 如:0表示文章,1表示视频,2表示音频,3表示问答
function typeText(isType)
{
    if(isType=="0")
    {
        return "文章";
    }
    else if(isType=="3")
    {
        return "问答";
    }
    else if(isType=="2")
    {
        return "音频";
    }
    else
    {
        return "视频";
    }
}

//全部产品中判断产品类型 如:0表示文章,1表示视频,2表示音频,3表示问答
function typeHref(objType,objId)
{
    if(objType=="0")
    {
        return "articleShow.aspx?Id="+objId;
    }
    else if(objType=="3")
    {
        return "questionShow.aspx?Id="+objId;
    }
    else if(objType=="2")
    {
        return "audioShow.aspx?Id="+objId;
    }
    else if(objType=="1")
    {
        return "videoShow.aspx?Id="+objId;
    }
    else
    {
        return "bookShow.aspx?Id="+objId;
    }
}
 
 
var objDivScreen = null;
var objDivMsg = null;

function setHtml(varUserSpecName)
{
    // 登录提示
    document.write('<div id="divPublicMsgInfo" style="position:absolute;display:none;z-index:101; background-color:White;border:1px solid #cccccc;">');
    document.write('<table width="100%"><tr><td height="25" colspan="2" align="center" valign="middle" style="font-weight: bold; font-size: 13px;" align="left">用户登录</td><td></td></tr>');

    document.write('<tr><td height="25">&nbsp;&nbsp;请选择：</td><td  align="left"><select id="drpRegType" style="width:63px;"><option value="0">用户名</option><option value="1">域  名</option></select> <input id="txtUserName" style="width:90px;" type="text" ></td><td></td></tr>');
    document.write('<tr><td height="25">&nbsp;&nbsp;密&nbsp;&nbsp;码：</td><td  align="left"><input id="txtUserPwd" type="password" style="height:18px;width:158px;" maxlength="16" /></td><td></td></tr>');
    document.write("<tr><td height=\"25\">&nbsp;&nbsp;验证码：</td><td align=\"left\"><input id=\"weblogin_validatecode\" type=\"text\" style=\"width:56px;\" >&nbsp;<img alt=\"看不清图片？点击可以更换图片\" style=\"Cursor:hand;\" onClick=ValidateCodeImage(this) src=\"ValidateCode.aspx\" id=\"ImgValidateCode\" align=\"absmiddle\"/> </td></tr>");
    document.write('<tr><td></td><td colspan="2" align="center" valign="middle" style="height:25px; color:#ffb019;"><input type="button" onclick="userLogin()" value="登录"> <input type="button" onClick="ClearFullScreen();" value="取消">&nbsp;&nbsp;<a href=\"http://www.wiseman.tv/UserRegisterFirst.aspx?recommendname="+varUserSpecName+"\" target=\"_blank\" style=\"color:red; text-decoration:underline;\">还没有注册？</a></td></tr>');
    document.write('</table>');
    document.write("</div>");
    // 停止营业提示
    document.write('<div id="divLockMsgInfo" style="position:absolute;display:none;z-index:102; background-color:White;border:1px solid #cccccc;">');
    document.write('<table width="100%"><tr><td height="25" colspan="2" align="center" valign="middle" style="font-weight: bold; font-size: 13px;" align="left">暂停营业</td></tr>');
    document.write('<tr><td height="20" id="thisShopCloseMng">该店暂停开放，请您联系店主或者稍候访问！</td></tr></table>');
    document.write('<tr><td height="20"><img src=/Images/lock.gif></td></tr></table>');
    document.write("</div>");

}

 //满屏遮罩
function FullScreen()
{   
    if (objDivMsg == null)
    {
        var objDiv = document.createElement("Div");
        document.body.appendChild(objDiv);
		objDivScreen = objDiv;
    };

    with(objDiv)
    {
        id = "divPublicFullScreen";
        with (style)
        { 
            zIndex = 100;
            width = document.body.clientWidth;
            height = document.body.scrollHeight;
            top = "0px";
            left = "0px";
            display = "block";
            position = "absolute";
            background = "AliceBlue";
            filter = "alpha(opacity=80)";
            opacity = 40/100;
            MozOpacity = 40/100
        };
    }
    DisplaySelect("none");
	document.body.onresize = function()
	{
		objDiv.style.width = document.body.clientWidth;
		objDiv.style.height = document.body.scrollHeight;
	}	
}


// 显示登录界面
function LoginShow()
{
	var h = 160;
	var w = 250;
	var y = (document.body.clientWidth - w) / 2;
	
	with(divPublicMsgInfo.style)
    {
		display = "inline";
		width = w;
		height = h;
		top = 200;
		left = y;
    };
    
    document.getElementById("txtUserName").value ="";
    document.getElementById("txtUserPwd").value = "";
    ValidateCodeImage(document.getElementById("ImgValidateCode"));
    
	divPublicMsgInfo.onkeyup = function() {if(window.event.keyCode == 13) userLogin();}

}

// 隐藏全屏遮罩
function ClearFullScreen()
{
    DisplaySelect("inline");
	objDivScreen.style.display = "none";
	divPublicMsgInfo.style.display = "none";
}

// 显示店铺关闭的提示
function CloseShow()
{
	var h = 150;
	var w = 250;
	var y = (document.body.clientWidth - w) / 2;
	
	with(divLockMsgInfo.style)
    {
		display = "inline";
		width = w;
		height = h;
		top = 200;
		left = y;
    };
}

//隐藏/显示所有select 
function DisplaySelect(strStyle)
{
    var objSelect = document.getElementsByTagName("select");
    for(var iLoop = 0; iLoop < objSelect.length; iLoop++)
    {
        objSelect[iLoop].style.display = strStyle;
    }
    
    document.getElementById("drpRegType").style.display = 'inline';
}

// 更换验证图片
function ValidateCodeImage(objImage)
{
    var date = new Date();
    var str = date.toLocaleString() + date.getMilliseconds();
    str = "ValidateCode.aspx?random=" + str;
    objImage.src = str; 
}

