/******************************
 *Filename:      o_style.js
 *Version:       1.0.0(20090621)
 *Website:       http://
 *Author:        S.S.L
*******************************/

function o_cookiestyle(){
	
	function getCookie(Name) { 
		var re=new RegExp(Name+"=[^;]+", "i"); //construct RE to search for target name/value pair
		if (document.cookie.match(re)) //if cookie found
		return document.cookie.match(re)[0].split("=")[1] //return its value
		return null
	}
	
	function setCookie(name, value, days) {
		var expireDate = new Date()
		//set "expstring" to either future or past date, to set or delete cookie, respectively
		var expstring=(typeof days!="undefined")? expireDate.setDate(expireDate.getDate()+parseInt(days)) : expireDate.setDate(expireDate.getDate()-5)
		document.cookie = name+"="+value+"; expires="+expireDate.toGMTString()+"; path=/";
	}
	
	function deleteCookie(name){
		setCookie(name, "moot")
	}
	
	function setStylesheet(title) {
		var i, cacheobj
		for(i=0; (cacheobj=document.getElementsByTagName("link")[i]); i++) {
			if(cacheobj.getAttribute("rel").indexOf("style") != -1 && cacheobj.getAttribute("title")) {
				cacheobj.disabled = true
				if(cacheobj.getAttribute("title") == title)
					cacheobj.disabled = false //enable chosen style sheet
			}
		}
	}
	
	function setActiveStyleSheet(styletitle){
		if (document.getElementById){
			setStylesheet(styletitle)
			setCookie("mysheet", styletitle, 365)
		}
	}
	
	this.doChange = function( styletitle ){
		setActiveStyleSheet(styletitle);
	}
	
	function init(){
		var selectedtitle=getCookie("mysheet");
		if (document.getElementById && selectedtitle!=null) //load user chosen style sheet if there is one stored
			setStylesheet(selectedtitle);
	}
	
	init();	
}
var o_cs = new o_cookiestyle();


function commentfix_1(){

//获取Class样式名对象集合：（class样式名），[Tag标签限定]，[父对象限定]
document.getElementsByClassName = function(cl, objName, parentNodeObj){
	var retnode = [], myclass = new RegExp('\\b' + cl + '\\b'), elem = (parentNodeObj == null) ? document.getElementsByTagName(objName) : parentNodeObj.getElementsByTagName(objName), classes;
	for (var j = 0; j < elem.length; j++) { classes = elem[j].className; if (myclass.test(classes)) retnode.push(elem[j]); }
	return retnode;
}

var s = document.getElementById("main_comment");

var objs = document.getElementsByClassName("children", "div", s);

function get_parentnode(n)
{
var x=n.previousSibling.previousSibling;
while (x.nodeType!=1)
  {
  x=x.previousSibling;
  }
return x;
}

for(var i = 0; i < objs.length; i++)
{
var objs2 = get_parentnode(objs[i]);
objs2.className = "commentfix_1";
}
	
}

/*显示flash 函数*/
function showFlash(iUrl,iWidth,iHeight,iWmode)
{
flash = '<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 +'" />';
flash = flash + '<param name="movie" value="'+ iUrl +'" />';
flash = flash + '<param name="quality" value="high" />';
flash = flash + '<param name="menu" value="false" />';
flash = flash + '<param name="allowScriptAccess" value="always" />';
if (iWmode == 1) {
	flash = flash + '<param name="wmode" value="transparent" />';		
}
flash = flash + '<embed src="' + iUrl + '" width="'+ iWidth +'" height="'+ iHeight +'" allowScriptAccess="always" menu="false" quality="high" ';
if (iWmode == 1) {
	flash = flash + 'wmode="transparent" ';		
}
flash = flash + ' pluginspage="http://www.macromedia.com/go/getflashplayer" type="application/x-shockwave-flash" mwode="transparent"></embed>';
flash = flash + '</object>';

document.writeln(flash); 

}
