function alertObj(obj , property)
{
	if (typeof(property)=='undefined') {
		property = '';
	}
    var name="";
    for(var i in obj) {
		if (i.toLowerCase().indexOf(property.toLowerCase())>=0) {
			name += i + ' = '+eval('obj.'+i)+"\n";
		}
	}
    alert(name);
}

function findParent(obj, parent_pre) {
	if ( obj.parentElement ) {
		if (obj.parentElement.id == '' || obj.parentElement.id.indexOf(parent_pre)!=0) {
			return findParent(obj.parentElement, parent_pre);
		}
		else {
			return obj.parentElement;
		}
	}
	return obj;
}

function writeFlash( id,pics,links,texts,focus_width,focus_height) {
	var text_height=30;
	var sVars = 'pics='+pics+'&links='+links+'&texts='+texts+'&borderwidth='+focus_width+'&borderheight='+focus_height+'&textheight='+text_height+'';
	var newsFlash = new SWFObject("http://rxsg.26play.com/images/focus.swf","flashnews",focus_width,focus_height+text_height,"6","");
	newsFlash.addParam("quality", "high");
	newsFlash.addParam("wmode", "transparent");
	newsFlash.addParam("FlashVars", sVars);
	newsFlash.write(id);

}
// news flash
function writeMyNewsFlash( id ) {
	if ($(id)) {
		var focus_width=300;
		var focus_height=220;
		var text_height=30;

		var pics='images/58.jpg|images/tmp_571.jpg|images/tmp_572.jpg|images/tmp_001.jpg|images/tmp_111.jpg';
		//var links='#|#'
		var links='http://sg.wangye173.com/news/show.php?itemid=236|http://bbs.wangye173.com/read.php?tid-10818-toread-1.html|http://bbs.wangye173.com/read.php?tid-10965-toread-1.html|http://sg.wangye173.com/news/show.php?itemid=228|http://sg.wangye173.com/news/show.php?itemid=179';
		var texts='《热血三国》单倍新服开启|热血三国新服火爆上线 极速抢号|小白必读之 热血三国单倍速新服激活流程|养精蓄锐待热血 再战三国闯新服|《热血三国》 即将封测';
	
		var sVars = 'pics='+pics+'&links='+links+'&texts='+texts+'&borderwidth='+focus_width+'&borderheight='+focus_height+'&textheight='+text_height+'';
		var newsFlash = new SWFObject("images/focus.swf","flashnews",focus_width,focus_height+text_height,"6","");
		newsFlash.addParam("quality", "high");
		newsFlash.addParam("wmode", "transparent");
		newsFlash.addParam("FlashVars", sVars);
		newsFlash.write(id);
	}
}

var scroll_height_per_line = 60;
var scroll_line_per_page = 4;
var scroll_total_line = 7;
var scroll_repeat = 30;
var scroll_height_per_page = scroll_height_per_line * scroll_line_per_page;
var scroll_sec_page_wait = 5;
var scroll_current = 0;
var scroll_paused = false; 

function startscroll( id ) {
	obj = $(id+'_inner');
	str = obj.innerHTML;
	var new_str = '';
	for (var i=0; i< scroll_repeat; i++ ) {
		new_str += str;
	}
	obj.innerHTML = new_str;
	setTimeout( 'scrolling( "'+id+'")' , scroll_sec_page_wait * 1000 );
}

function scrolling( id ) {
	micro_scrolling( id );
	setTimeout( 'scrolling( "'+id+'")' , scroll_sec_page_wait * 1000 );
}

function micro_scrolling( id ) {
	if (!scroll_paused) {
		scroll_current += 20;
		obj = $(id+'_inner');
		total_height = ((scroll_total_line - scroll_total_line % scroll_line_per_page) / scroll_line_per_page + 1 ) * scroll_height_per_page * scroll_repeat;
		if (scroll_current >= total_height) {
			scroll_current = 0;
		}
		if (obj) {
			obj.style.top = -scroll_current + 'px';
		}
	}
	if (scroll_current % scroll_height_per_page)
		setTimeout( ' micro_scrolling( "'+id+'" )', 10 );
	return;
}

function scroll_continue() {
	scroll_paused = false;
}
function scroll_pause() {
	scroll_paused = true;
}
