﻿//样式
function fnSkin()
{
	if (arguments.length > 0)
	{
		$("#docSkin").attr("href", arguments[0]);
		$.cookie("Skin", arguments[0], { expires: 1000, path: "/" });

	}
	else
	{
		if ($.cookie("Skin") != null)
		{
			fnSkin($.cookie("Skin"));
		}
	}
}

function fnSkinBar()
{
	var placeholder = "&nbsp;&nbsp;";
	$("#docSkinRed").html(placeholder);
	$("#docSkinGreen").html(placeholder);
	$("#docSkinBlue").html(placeholder);
	$("#docSkinOrange").html(placeholder);
}

fnSkin();

//焦点图片
function fnFocusImage()
{
	var interval_time = 5 //图片停顿时间，单位为秒，为0则停止自动切换
	var focus_width = 240 //宽度
	var focus_height = 180 //高度
	var text_height = 0 //标题高度
	var text_align = 'center' //标题文字对齐方式(left、center、right)
	var swf_height = focus_height + text_height //相加之和最好是偶数,否则数字会出现模糊失真的问题

	var _news = arguments[0];

	var pics = links = texts = "";
	for (var i = 0; i < news.length; i++)
	{
		pics += "|" + _news[i][0];
		links += "|" + _news[i][1];
		texts += "|" + _news[i][2];
	}
	pics = pics.replace("|", "");
	links = links.replace("|", "");
	texts = texts.replace("|", "");

	document.write('<object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=8,0,0,0" width="' + focus_width + '" height="' + swf_height + '">');
	document.write('<param name="movie" value="images/pixviewer.swf"><param name="quality" value="high"><param name="bgcolor" value="#ffffff">');
	document.write('<param name="menu" value="false"><param name=wmode value="opaque">');
	document.write('<param name="FlashVars" value="pics=' + pics + '&links=' + links + '&texts=' + texts + '&borderwidth=' + focus_width + '&borderheight=' + focus_height + '&textheight=' + text_height + '&text_align=' + text_align + '&interval_time=' + interval_time + '">');
	document.write('<embed src="images/pixviewer.swf" wmode="opaque" FlashVars="pics=' + pics + '&links=' + links + '&texts=' + texts + '&borderwidth=' + focus_width + '&borderheight=' + focus_height + '&textheight=' + text_height + '&text_align=' + text_align + '&interval_time=' + interval_time + '" menu="false" bgcolor="#ffffff" quality="high" width="' + focus_width + '" height="' + swf_height + '" allowScriptAccess="sameDomain" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" />');
	document.write('</object>');
}

function fnFocusImages2()
{
	//焦点图片

	//	焦点图片
	//	var imgUrl1 = "http://www.21cs.cn/up_load/images/2011/5/ad-bf-ab-ce.jpg";
	//	var imgText1 = "常熟市劳动模范暨技能大赛表彰大会";
	//	var imgLink1 = "http://www.21cs.cn/details?id=313763";

	//	焦点图片
	//	var imgUrl2 = "http://www.21cs.cn/up_load/images/2011/4/cj-be-af-fc.jpg";
	//	var imgText2 = "611户家庭喜获经济适用住房购买资格";
	//	var imgLink2 = "http://www.21cs.cn/details?id=313666";

	//	焦点图片
	//	var imgUrl3 = "http://www.21cs.cn/up_load/images/2011/4/ch-ai-fh-ad.jpg";
	//	var imgText3 = "我市公布房地产价格调控目标";
	//	var imgLink3 = "http://www.21cs.cn/details?id=313545";


	var _news = arguments[0];

	var pics = links = texts = "";
	for (var i = 0; i < news.length; i++)
	{
		pics += "|" + _news[i][0];
		links += "|" + _news[i][1];
		texts += "|" + _news[i][2];
	}
	pics = pics.replace("|", "");
	links = links.replace("|", "");
	texts = texts.replace("|", "");


	//焦点属性
	var focus_width = 240;
	var focus_height = 180;
	var text_height = 0;
	var swf_height = focus_height + text_height;
	//var pics = imgUrl1 + "|" + imgUrl2 + "|" + imgUrl3;
	//var links = imgLink1 + "|" + imgLink2 + "|" + imgLink3;
	//var texts = imgText1 + "|" + imgText2 + "|" + imgText3;
	document.write('<object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,0,0" width="' + focus_width + '" height="' + swf_height + '">');
	document.write('<param name="movie" value="/images/focus.swf"><param name="bgcolor" value="#f0f0f0">');
	document.write('<param name="menu" value="false">');
	document.write('<param name="wmode" value="opaque">');
	document.write('<param name="FlashVars" value="pics=' + pics + '&links=' + links + '&texts=' + texts + '&borderwidth=' + focus_width + '&borderheight=' + focus_height + '&textheight=' + text_height + '">');
	document.write('<embed src="images/focus.swf" FlashVars="pics=' + pics + '&links=' + links + '&texts=' + texts + '&borderwidth=' + focus_width + '&borderheight=' + focus_height + '&textheight=' + text_height + '" menu="false" bgcolor="#f0f0f0" quality="high" width="' + focus_width + '" height="' + focus_height + '" allowScriptAccess="sameDomain" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" />');
	document.write('</object>');
}


//热点视频
function fnHotVideo()
{
	var _text = (arguments.length < 1) ? $(".cssPart_A_3_1 li a").attr("title") : arguments[0].title;
	var _href = (arguments.length < 1) ? $(".cssPart_A_3_1 li a").attr("href") : arguments[0].href;

	$(".cssPart_A_3_1_1 a").text(_text);
	$(".cssPart_A_3_1_1 a").attr("href", _href);
}

//flash播放器(data,width,height)
function fnFlash()
{
	var _sData = arguments[0];
	var _iWidth = arguments[1];
	var _iHeight = arguments[2];

	var _sHtml = '<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,19,0" width="' + _iWidth + '" height="' + _iHeight + '">';
	_sHtml += '<param name="movie" value="' + _sData + '" />';
	_sHtml += '<param name="quality" value="high" />';
	_sHtml += '<param name="menu" value="false" />';
	_sHtml += '<param name="wmode" value="transparent" />';
	_sHtml += '<embed src="' + _sData + '" wmode="transparent" menu="false" quality="high" pluginspage="http://www.macromedia.com/go/getflashplayer" type="application/x-shockwave-flash" width="' + _iWidth + '" height="' + _iHeight + '"></embed>';
	_sHtml += '</object>';
	document.write(_sHtml);
}

//flash播放器(data,width,height,link)
function fnFlash2()
{
	var _sData = arguments[0]; 	//flash文件url
	var _iWidth = arguments[1]; 	//宽度
	var _iHeight = arguments[2]; //高度
	var _sLink = arguments[3]; 	//链接
	if (_sLink != undefined)
	{
		document.write('<a href="' + _sLink + '"><img style="position: absolute;z-index:100;display:block;" src="http://images.21cs.cn/empty.gif" width="' + _iWidth + '" height="' + _iHeight + '" /></a>');
	}
	document.write('<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,19,0" width="' + _iWidth + '" height="' + _iHeight + '">');
	document.write('<param name="movie" value="' + _sData + '" /><param name="menu" value="false" />');
	document.write('<param name="quality" value="high" /><param name="wmode" value="opaque" />');
	document.write('<embed src="' + _sData + '" menu="false" wmode="opaque" quality="high" pluginspage="http://www.macromedia.com/go/getflashplayer" type="application/x-shockwave-flash" width="' + _iWidth + '" height="' + _iHeight + '"></embed>');
	document.write('</object>');
}
