//common.js
function posit(x,y,w,d)
{
	self.moveTo(x,y) 
	self.resizeTo(w,d) 
}
//
function theweek()
{
	var Jtoday=new Date();
	var Jmonth=Jtoday.getMonth();
	var Jday=Jtoday.getDate();
	return floor((jmonth*30 + jday)/7);
}
//
function favorate()
{
	if (isie())
	{
		var cmd="external.addFavorite('http://clansoft.yeah.net','科蓝软件工作室')";
		document.write("<a href=# onClick="+cmd+"><font color=red><u>将本站放入收藏夹</u></font></a>");
	}
}

//
function isie()
{
	ie=document.all?1:0;
	return ie;
}

//
function jumpout()
{
	if(parent.frames.length!=0) parent.location=document.location.href;
}

//
function calender()
{
	var weekdays=new Array("日","一","二","三","四","五","六");
	var date_str;

	var Jtoday=new Date();

	var Jyear=Jtoday.getYear();
	var Jmonth=Jtoday.getMonth()+1;
	var Jday=Jtoday.getDate();
	var Jweekday=Jtoday.getDay();
	
	date_str=Jyear+"年"+Jmonth+"月"+Jday+"日 "+"星期"+weekdays[Jweekday]

	document.write(date_str);
}

//	图形斑	-		-		-		-		-
function setIMG()
{
	var x = Math.floor(Math.random(1)*(graphs.length/3));

	ranimg.src=graphs[3*x+1];
	ranlink.href=graphs[3*x];

	var secnum = Math.floor(Math.random(1)*10);

	setTimeout(setIMG,5000+secnum*1000);
}

function randomIMG()	//init
{
	var x = Math.floor(Math.random(1)*(graphs.length/3));
	if (isie())
	{
		document.write("<a name=ranlink href="+graphs[x*3]+graphs[x*3+2]+"><img name=ranimg src="+graphs[x*3+1]+" border=0 width=468 height=60 title='科蓝工作室广告'></a>");
		var secnum = Math.floor(Math.random(1)*10);
		setTimeout(setIMG,5000+secnum*1000);

	} else
	{
		if (graphs[x]=="#null") document.write(IMG[x]);
		else 
			document.write("<a href="+graphs[x*3]+graphs[x*3+2]+" title='科蓝工作室广告'><img src="+graphs[x*3+1]+" border=0 width=468 height=60></a>");
	}
}
//	文字斑	-		-		-		-		-

var items=new Array(
	"http://#","OICQ: 11497786","",
	"http://#","OICQ: 11497786","",
	"http://#","OICQ: 11497786","",
	"http://#","技术支持，数据抢救","",
	"http://#","域名申请，主机空间","",
	"http://#","软件开发，网站建设","",
	"http://#","clansoft@saihu.com","",
	"http://#","二进制编辑器支持 Binary 及 ASCII 模式搜索","",
	"http://#","UNIX 原创网站",""
	);
var colors=new Array('#000000','#0000ff','#00ff00','#00ffff','#ff0000','#ff00ff','#ffff00');

function setMESSAGE()
{
	var x = Math.floor(Math.random(1)*(items.length/3));

	ranlink.innerText=items[3*x+1];
	ranlink.href=items[3*x];

	setTimeout(setMESSAGE,6000);
}

function randomMESSAGE()	//init
{
	var x = Math.floor(Math.random(1)*(items.length/3));
	if (isie())
	{
		document.write("<a name=ranlink href="+items[x*3]+items[x*3+2]+"><u>"+items[x*3+1]+"</u></a>");
		setTimeout(setMESSAGE,6000);
	} else
	{
		if (items[x]=="#null") document.write(message[x]);
		else document.write("<a href="+items[x*3]+items[x*3+2]+"><u>"+message[x*3+1]+"</u></a>");
	}

}

//	文字marquee斑	-		-		-		-		-

var colors=new Array("#000000","#000088","#0000ff","#008800","#008888","#0088ff","#00a010","#1100ff","#11111","#333333","#50b000","#880000","#8800ff","#888800","#888888","#8888ff","#aa00cc","#aaaa00","#ccaa00","#ff0000","#ff0088","#ff00ff","#ff8800","#ff0005","#ff88ff","#ee0005","#ee01ff","#3388aa");
function randcolor()
{
	var x = Math.floor(Math.random(1)*(colors.length));
	return colors[x];
}

//	文字marquee斑	-		-		-		-		-

var marquees=new Array(
	"网络科技★挑战传统媒体",	"http://clansoft.saihu.com",
	"取之于网★用之于网",		"http://clansoft.saihu.com",
	"选择科蓝工作室★铸造网络家园",	"http://clansoft.saihu.com",
	"科蓝工作室是您通向世界的窗口",	"http://clansoft.saihu.com",
	"二十世纪是互连网的时代，中国企业你准备好了吗？",	"http://clansoft.saihu.com",
	"电子商务★风行全球",		"http://clansoft.saihu.com",
	"科蓝工作室--用科技创造未来",	"http://clansoft.saihu.com",
	"网络科技★把握商机无限",	"http://clansoft.saihu.com",
	"网络★带您迈进全球e-business时代","http://clansoft.saihu.com",
	"早一天上网★早一天受益",	"http://clansoft.saihu.com",
	"技术是网站的第一生命力！",	"http://clansoft.saihu.com",
	"带您进入互连网时代！",	"http://clansoft.saihu.com",
	"科蓝工作室--您贴心的朋友！",		"http://clansoft.saihu.com",
	"立足衡水★面向世界",		"http://clansoft.saihu.com",
	"科蓝工作室★ClanSoft Studiio",		"http://clansoft.saihu.com",
	"迎接电子商务时代★中国企业，一路走好！",	"http://clansoft.saihu.com"
	);

function setMARQUEE()
{
	var x = Math.floor(Math.random(1)*(marquees.length/2));

	ranmarqueetext.color=randcolor();

	if (Math.random(1)<0.33) {		// 1/3 的可能改换文本
		ranmarqueetext.innerText=marquees[x*2];
		ranmarqueelink.href=marquees[x*2+1];
	}

	setTimeout(setMARQUEE,5000);
}

function randomMARQUEE()	//init
{
	var x = Math.floor(Math.random(1)*(marquees.length/2));
	if (isie())
	{
		document.write("<a name=ranmarqueelink href="+marquees[x*2+1]+" target=_blank><marquee width=100% behavior=scroll><b><font id=ranmarqueetext style='font-size:9pt'>"+marquees[x*2]+"</font></b></marquee></a>");
		ranmarqueetext.color=randcolor();
		setTimeout(setMARQUEE,5000);
	}
}

function get_cookie(name)
{
	var i,temp;
	var cookiestring=document.cookie;
	splitcookie=cookiestring.split("; ");
	for(i=0;i<splitcookie.length;i++)
	{
		temp=splitcookie[i];

		if (temp.indexOf(name+"=")==0)
		{
			return(temp.replace(name+"=",""));
		}
	}
	return "";
}
//- second timeout
function set_cookie_s(name, value, expires, path, domain, secure) {
	var exp = new Date();
	exp.setTime(exp.getTime() + (expires*1000));

        var curCookie = name + "=" + value  +
                ((expires) ? "; expires=" + exp.toGMTString() : "") +
                ((path) ? "; path=" + path : "") +
                ((domain) ? "; domain=" + domain : "") +
                ((secure) ? "; secure" : "")
                document.cookie = curCookie
}

//		-		-		-		-		-
function enlarge()
{
	posit(0,0,screen.availWidth,screen.availHeight);
}

//		-		-		-		-		-
function menu()
{
var i;
var items=new Array(
	"工作室","studio.htm title='Clansoft Studio Introduce'","",
	"科蓝软件","index.html title='Homepage eg. Software'","",
	"UNIX文摘","article.htm title='Unix Tips'","",
	"网站建设","netagent.htm title='Net Agent'","",
	"留言板","http://center.saihu.com/guestbook/gbook.php?gbid=clansoft title=GuestBook",""
	);

	for (i=0;i<items.length/3;i++) document.writeln("<td width=80 align=center class=mainmenu><a href=", items[i*3+1], items[i*3+2],"><b>",items[i*3],"</b></a></td>");
}

//
function ehnthead()
{
//enlarge();

document.writeln("	<table cellspacing=0 width=750 align=center>");

document.writeln("	<tr><td colspan=2>");
randomMARQUEE();	// clansoft not use this
document.writeln("	</td></tr>");

document.writeln("	<tr>");
document.writeln("		<td>");

if (location.href.lastIndexOf('big5')>0)
	document.write("			<a href=/index.html");
else	document.write("			<a href=/big5/index.html");
document.writeln(" title='GBCODE - BIG5'><img src=/img/clanlogo.gif border=0 width=268 height=60></a>");

document.writeln("		</td>");
document.writeln("		<td>");

document.write("<iframe width=468 height=60 MARGINWIDTH=0 MARGINHEIGHT=0 HSPACE=0 VSPACE=0 FRAMEBORDER=0 SCROLLING=no src=clanads.htm></iframe>");

document.writeln("		</td>");
document.writeln("	</tr>");
document.writeln("	</table>");


document.writeln("	<table cellspacing=0 width=750 align=center>");
document.writeln("	<tr>");
document.writeln("		<td width=60><a href=/index.html title=GBCODE><b>国标码</b></a></td>");
document.writeln("		<td width=40><a href=/big5/index.html title=TAIWAN><b>BIG5</b></a></td>");
document.writeln("		<td width=480 align=center>");
document.writeln("			<img src=/img/cstar.gif width=25 height=20>");

randomMESSAGE();

document.writeln("		</td>");
document.writeln("		<td align=right>");
document.writeln("			<a href=mailto:clansoft@saihu.com title='Or QQ: 11497786'>联系我们</a>");
document.writeln("		</td>");
document.writeln("	</tr>");
document.writeln("	<tr>");
document.writeln("		<td colspan=5 bgcolor=#000000 height=2></td>");
document.writeln("	</tr>");
document.writeln("	</table>");

document.writeln("	<table cellspacing=0 width=750 align=center bgcolor=#ddbb99>");
document.writeln("	<tr>");

menu();

document.writeln("		<td align=right>");
calender();
document.writeln("		</td>");

document.writeln("	</tr>");
document.writeln("	</table>");
}


//		-		-		-		-		-
function ehntfoot()
{
document.writeln("	<table cellspacing=0 width=750 align=center bgcolor=#ddbb99>");
document.writeln("	<tr>");

menu();

document.writeln("		<td align=right>");

var url;
var pos;

pos=location.href.lastIndexOf('#');
if (pos>=0) url=location.href.substring(0,pos); else url=location.href;
document.writeln("			<a href="+url+" title='GO TOP'><u>↑页首</u></a>");

pos=location.href.lastIndexOf('/');
if (pos>=0) url=location.href.substring(0,pos); else url=location.href;
document.writeln("			<a href="+url+"/index.html title='GO HOMEPAGE'><u>首页</u></a>");

document.writeln("		</td>");
document.writeln("	</tr>");
document.writeln("	</table>");

document.writeln("	<table cellspacing=0 width=750 align=center>");
document.writeln("	<tr>");
document.writeln("		<td></td>");
document.writeln("	</tr>");
document.writeln("	<tr>");
document.writeln("		<td bgcolor=#000000 height=2></td>");
document.writeln("	</tr>");
document.writeln("	<tr>");
document.writeln("		<td align=center>");

document.writeln("<iframe width=468 height=60 MARGINWIDTH=0 MARGINHEIGHT=0 HSPACE=0 VSPACE=0 FRAMEBORDER=0 SCROLLING=no src=clanads-b.htm></iframe>");

document.writeln("			<br>");
document.writeln("			<div style='font-size:9pt'>");
document.writeln("			建议使用 IE4.0、Netscape4.0、Opera3.60 以上浏览器、分辨率８００＊６００观看");
document.writeln("			</div>");
document.writeln("			<center><script src=/cgi-bin/pagecount.cgi></script><br>");
document.writeln("			<center><b>&copy; 2001 <a href=mailto:clansoft@saihu.com>科蓝软件工作室</a>版权所有</b><br>");
document.writeln("		</td>");
document.writeln("	</tr>");
document.writeln("	</table>");
}
