var defaultStockCode;
var features;
var url;
var h=window.screen.height;
var w=window.screen.width;
defaultStockCode=600000;
features="toolbar=yes,location=yes,status=yes,menubar=yes,scrollbars=yes,resizable=yes,height="+h+",width="+w;

function favPage(){ 
    var pageName=window.location.href;
    var nameArr =pageName.split("?");
    pageName=nameArr[0] + "?" + nameArr[1];
    if(window.sidebar){
        window.sidebar.addPanel(document.title,pageName,"");
    }
    else if(document.all){
        window.external.AddFavorite(pageName,document.title);
    }
    else{
        return true; 
    }
}
function SetHome(obj,vrl){
	try{
		obj.style.behavior='url(#default#homepage)';obj.setHomePage(vrl);
	}
    catch(e){
        if(window.netscape){
            try{
                netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect"); 
            } 
            catch(e){ 
                alert("此操作被浏览器拒绝！\n请在浏览器地址栏输入“about:config”并回车\n然后将[signed.applets.codebase_principal_support]设置为'true'"); 
            }
            var prefs = Components.classes['@mozilla.org/preferences-service;1'].getService(Components.interfaces.nsIPrefBranch);
            prefs.setCharPref('browser.startup.homepage',vrl);
        }
    }
}

function DateAdd(number,date){
    var hdateobj;
	var hyear;
    var hmonth;
    var hday;
	var hweek;
	var hhistory;
	hdateobj=new Date();
	hyear=hdateobj.getYear();
	hmonth=hdateobj.getMonth()+1;	
	hweek=hdateobj.getDay()+number;
	hday=hdateobj.getDate()+number;	
	if (hweek<0){
	    hweek=7+hweek;
	}
	if(hweek==6){
        hday=hday-1;
    }
    else if(hweek==0){
        hday=hday-2;
    }
	if (hday<=0){	    
		hmonth=hmonth-1;
		if(hmonth==0){
			hmonth=12;
			hyear=hyear-1;
		}
		if(hmonth==1||hmonth==3||hmonth==5||hmonth==7||hmonth==8||hmonth==10||hmonth==12){
		    hday=31+hday;
		}
		else if(hmonth==2){
			hday=28+hday;
		}
		else{
			hday=30+hday;
		}
	}
	hyear=""+hyear;
	if(hmonth<10){
	    hmonth="0"+hmonth;
	}	
	if(hday<10){
	    hday="0"+hday;
	}
    hday=""+hday;	
	hhistory=hyear+hmonth+hday;
	if(isholiday(""+hmonth+hday)){
		hhistory="091231";
	}
	return hhistory;
}

function isholiday(date){
    if(date=="1001"||date=="1002"||date=="1003"||date=="1004"||date=="1005"||date=="1006"||date=="1007"||date=="1008"||date=="0101"||date=="0102"||date=="0103"){
	    return true;	
	}
	else{
		return false;
	}
}

function oCopy(str)
{
    var words;
	var i;
	words=str;
	i=words.split('http://');
	url="http://"+i[1]+"http://"+i[2]+"&amp;title="+i[0];
	window.open(url,'推荐给好友',features);
}
function checkquestions(){
    if(document.theForm.questions.value==""){
	    alert("请输入您的问题");
		document.theForm.questions.focus();
		return false;
	}
	if(document.theForm.types.value==0){
	    alert("请选择您的问题分类");
		document.theForm.types.focus();
		return false;
	}
	if(document.theForm.score.value>200){
	    alert("您的悬赏分不能超过200，请重新输入");
		document.theForm.score.focus();
		return false;
	}
}

function copy()   
{ 
    url="http://www.guyii.com/bbs/reg.asp";
	
	window.open(url,'注册会员获得黑马',features);
}

function Question(){
	
	url="http://www.guyii.com/question/index.asp?action=frameon";
	
	window.open(url,'股问吧',features);
}

function showzjll(tableid){
	tableid.style.display="";
}
function hidezjll(tableid){
	tableid.style.display="none";
}

function check(stockCode)
{
    var isPassCheck = true;	
    if(stockCode == null || stockCode == "" || stockCode.length != 6)
    {
    	alert("请输入证券代码！");
    	isPassCheck = false;
    }
    if(stockCode.charAt(0) != "6" && stockCode.charAt(0) != "0" )
    {
    	alert("只能够查询上证所和深证所股票，请输入6开头或者0开头的证券代码！");
    	isPassCheck = false;    	
    }
    
    return isPassCheck;
}

function allviewClick(){
	
	defaultStockCode = document.getElementById("allview_code").value;
	
	url="http://www.guyii.com/data/allview/"+defaultStockCode+".htm";
    
	window.open(url,'股逸数据网股逸共赢allview',features);
}

function ddeClick(){
	
	defaultStockCode = document.getElementById("dde_code").value;
	
	url="http://www.guyii.com/data/dde/"+defaultStockCode+".htm";
    
	window.open(url,'股逸数据网DDE',features);
}

function xxld()
{
	defaultStockCode = document.getElementById("xxld_code").value;
	
	if(!check(defaultStockCode))
	    return;
	
	url="http://www.guyii.com/data/xxld/"+defaultStockCode+".htm";
	
	window.open(url,'股逸网信息雷达',features);
}

function ztbj(){
	url="http://www.guyii.com/heima/zhangting.asp";
	window.open(url,'股逸网涨停搏击',features);
}

function dxsy(){
	url="http://www.guyii.com/heima/duanxian.asp";
	window.open(url,'股逸网短线是银',features);
}

function zxsj(){
	url="http://www.guyii.com/heima/zhongxian.asp";
	window.open(url,'股逸网中线是金',features);
}

function bkClick()
{
	defaultStockCode = document.getElementById("blockcode").value;
		
	url="http://www.guyii.com/data/zjlx.asp?no="+defaultStockCode;
    
	window.open(url,'股逸数据网板块资金流向',features);
}

function zjlxClick()
{
	defaultStockCode = document.getElementById("zjlx_code").value;
	
	if(!check(defaultStockCode))
	    return;
	
	url="http://www.guyii.com/data/zjlx/"+defaultStockCode+".htm";
    
	window.open(url,'股逸数据网个股资金流向',features);
}

function jgldClick()
{
	defaultStockCode = document.getElementById("jgld_code").value;
	
	if(!check(defaultStockCode))
	    return;
	
	url="http://www.guyii.com/data/jgld/"+defaultStockCode+".htm";
    
	window.open(url,'股逸数据网机构雷达',features);
}

function fxpjClick()
{
	defaultStockCode = document.getElementById("fxpj_code").value;
	
	if(!check(defaultStockCode))
	    return;
	
	url="http://www.guyii.com/data/fxpj/"+defaultStockCode+".htm";
    
	window.open(url,'股逸数据网风险评价',features);
}

function zjldClick()
{
    defaultStockCode = document.getElementById("zjld_code").value;
	
	if(!check(defaultStockCode))
	    return;
	
	url="http://www.guyii.com/data/zjld/"+defaultStockCode+".htm";
    
	window.open(url,'股逸数据网资金雷达',features);
}

function superviewClick()
{
	defaultStockCode = document.getElementById("superview_code").value;
	
	if(!check(defaultStockCode))
	    return;
		
	url="http://www.guyii.com/data/superview/"+defaultStockCode+".htm";
	
	window.open(url,'股逸数据网超赢superview',features);
}

function superviewbClick()
{
	defaultStockCode = "b0000";	
		
	url="http://www.guyii.com/data/svblock.htm";
	
	window.open(url,'股逸数据网超赢superview板块',features);
}

function totalviewzClick()
{
	defaultStockCode = "z0000";	
		
	url="http://www.guyii.com/data/totalview/"+defaultStockCode+".htm";
	
	window.open(url,'股逸数据网全赢totalview主力',features);
}

function superviewddeClick()
{
	defaultStockCode = "d0000";	
		
	url="http://www.guyii.com/data/svblockdde.htm";
	
	window.open(url,'股逸数据网超赢superviewDDEDDX',features);
}

function totalviewClick()
{
	defaultStockCode = document.getElementById("totalview_code").value;
	
	if(!check(defaultStockCode))
	    return;
		
	url="http://www.guyii.com/data/totalview/"+defaultStockCode+".htm";
	
	window.open(url,'股逸数据网全赢totalview',features);
}

function qddeddxClick(){
	url="http://www.guyii.com/data/ddeddx.asp";
	
	window.open(url,'股逸数据网DDEDDX',features);
}

function ddeddxClick()
{
	defaultStockCode = document.getElementById("ddeddx_code").value;
	
	if(!check(defaultStockCode))
	    return;
		
	url="http://www.guyii.com/data/dde/"+defaultStockCode+".htm";
	
	window.open(url,'股逸数据网DDEDDX',features);
}

function dpzs()
{
	url="http://www.guyii.com/hangqing/index.htm";
	window.open(url,'股逸行情网',features);
}

function bkzs()
{
	url="http://www.guyii.com/hangqing/stockblock.htm.htm";
	window.open(url,'股逸行情网板块',features);
}

function f10Click()
{
	defaultStockCode = document.getElementById("f10_code").value;
	
	if(!check(defaultStockCode))
	    return;
		
	url="http://www.guyii.com/data/f10.asp/"+defaultStockCode+".htm";
	
	window.open(url,'股逸数据网F10',features);
}

function ggzs()
{
	defaultStockCode = document.getElementById("ggzs_code").value;
	
	if(!check(defaultStockCode))
	    return;
	
	if(defaultStockCode.charAt(0) == "6")
    {
    	defaultStockCode = "sh"+defaultStockCode;
    }
	if(stockCode.charAt(0) == "0" )
    {
    	defaultStockCode = "sz"+defaultStockCode;	
    }
	
	url="http://www.guyii.com/hangqing/realstock.htm?code"+defaultStockCode;
	
	window.open(url,'股逸行情网个股',features);
}

function wwsc()
{
	url="http://www.guyii.com/hangqing/waiwei.htm";
	window.open(url,'股逸行情网外围',features);
}

function Search()
{
    var action;
	
	action=document.getElementById("Search").value;
	
	defaultStockCode = document.getElementById("StockCode").value;
	
	if(!check(defaultStockCode))
	    return;
		
	if(action==1){
		url="http://www.guyii.com/data/superview/"+defaultStockCode+".htm";
	}
	if(action==2){
		url="http://www.guyii.com/data/totalview/"+defaultStockCode+".htm";
	}
	if(action==3){
		url="http://www.guyii.com/data/dde/"+defaultStockCode+".htm";
	}
	if(action==4){
	    url="http://www.guyii.com/data/zjlx/"+defaultStockCode+".htm";
	}
	if(action==5){
		if(defaultStockCode.charAt(0)==6)
		    defaultStockCode = "sh" + defaultStockCode;
		if(defaultStockCode.charAt(0)==0)
		    defaultStockCode = "sz" + defaultStockCode;
        url="http://www.guyii.com/hangqing/realstock.htm?code="+defaultStockCode;
	}
	if(action==6){
	    url="http://www.guyii.com/stock.asp?code="+defaultStockCode;
	}
	
	window.open(url,'股逸网',features);
}