function xenqing_ns(){
	//SAMPLE 8
	var handles8_more = $$('#handles8_more span');
	var nS8 = new noobSlide({
		box: $('box8'),
		items: $$('#box8 h3'),
		size: 460,
		handles: $$('#handles8 span'),
		addButtons: {previous: $('prev8'), play: $('play8'), stop: $('stop8'), playback: $('playback8'), next: $('next8') },
		onWalk: function(currentItem,currentHandle){
			//style for handles
			$$(this.handles,handles8_more).removeClass('active');
			$$(currentHandle,handles8_more[this.currentIndex]).addClass('active');
			//text for "previous" and "next" default buttons
			$('prev8').set('html','&lt;&lt; '+this.items[this.previousIndex].innerHTML);
			$('next8').set('html',this.items[this.nextIndex].innerHTML+' &gt;&gt;');
		}
	});
	//more "previous" and "next" buttons
	nS8.addActionButtons('previous',$$('#box8 .prev'));
	nS8.addActionButtons('next',$$('#box8 .next'));
	//more handle buttons
	nS8.addHandleButtons(handles8_more);
	//walk to item 3 witouth fx
	nS8.walk(3,false,true);
	nS8.play(3000,'next',false);
}

function xenqing_tooltip(){
	//store titles and text
	$$('a.tipz').each(function(element,index) {
		var content = element.get('title').split('::');
		element.store('tip:title', content[0]);
		element.store('tip:text', content[1]);
	});
	
	//create the tooltips
	var tipz = new Tips('.tipz',{
		className: 'tipz',
		fixed: false,
		offsets: {'x': 80, 'y': -100},
		hideDelay: 50,
		showDelay: 50
	});		
	/*
	tipz.addEvents({
		'show': function(tip) {
			tip.fade('in');
		},
		'hide': function(tip) {
			tip.fade('out');
		}
	});
	*/
}

function login_alert(){
  var msgw,msgh,bordercolor;
  msgw=500;//提示窗口的宽度
  msgh=400;//提示窗口的高度
  titleheight=45//提示窗口标题高度
  bordercolor="#5b92bb";//提示窗口的边框颜色
  titlecolor="#FFFFFF";//提示窗口的标题颜色
  str="<%= flash[:error] %><div class='center'>" +
  	"<form action='/account/authenticate' method='post'>  <div><img src='/images/login.png' width=480px height=300px></div>"+
  	"<div>用户名：<input id='user_username' name='user[username]' size='10' type='text' />"+
  	"密码:<input id='user_password' name='user[password]' size='10' type='password' /> |"+
  	"<input name='commit' type='submit' value='登录' /> | <a href='/users/new'>注册</a></div></form></div>"
  
  var sWidth,sHeight;
  sWidth=document.body.offsetWidth;//浏览器工作区域内页面宽度 或使用 screen.width//屏幕的宽度
  sHeight=screen.height;//屏幕高度（垂直分辨率）

  //背景层（大小与窗口有效区域相同，即当弹出对话框时，背景显示为放射状透明灰色）
  var bgObj=document.createElement("div");//创建一个div对象（背景层） //动态创建元素，这里创建的是 div
  //定义div属性，即相当于(相当于，但确不是，必须对对象属性进行定义
  //<div id="bgDiv" style="position:absolute; top:0; background-color:#777; filter:progid:DXImagesTransform.Microsoft.Alpha(style=3,opacity=25,finishOpacity=75); opacity:0.6; left:0; width:918px; height:768px; z-index:10000;"></div>
  bgObj.setAttribute('id','bgDiv');
  bgObj.style.position="absolute";
  bgObj.style.top="0";
  bgObj.style.background="#777";
  bgObj.style.filter="progid:DXImageTransform.Microsoft.Alpha(style=3,opacity=25,finishOpacity=75";
  bgObj.style.opacity="0.6";
  bgObj.style.left="0";
  bgObj.style.width=sWidth + "px";
  bgObj.style.height=sHeight + "px";
  bgObj.style.zIndex = "10000";
  document.body.appendChild(bgObj);//在body内添加该div对象
  //创建一个div对象（提示框层）
  var msgObj=document.createElement("div")
  //定义div属性，即相当于
  //<div id="msgDiv" align="center" style="background-color:white; border:1px solid #336699; position:absolute; left:50%; top:50%; font:12px/1.6em Verdana,Geneva,Arial,Helvetica,sans-serif; margin-left:-225px; margin-top:npx; width:400px; height:100px; text-align:center; line-height:25px; z-index:100001;"></div>
  msgObj.setAttribute("id","msgDiv");
  msgObj.setAttribute("align","center");
  msgObj.style.background="white";
  msgObj.style.border="3px solid " + bordercolor;
  msgObj.style.position = "absolute";
  msgObj.style.left = "50%";
  msgObj.style.top = "50%";
  msgObj.style.font="12px/1.6em Verdana, Geneva, Arial, Helvetica, sans-serif";
  msgObj.style.marginLeft = "-255px" ;
  msgObj.style.marginTop = -175+document.documentElement.scrollTop+"px";
  msgObj.style.width = msgw + "px";
  msgObj.style.height =msgh + "px";
  msgObj.style.textAlign = "center";
  msgObj.style.lineHeight ="25px";
  msgObj.style.zIndex = "10001";

  var title=document.createElement("div");//创建一个h4对象（提示框标题栏）
  //定义h4的属性，即相当于
  //<h4 id="msgTitle" align="right" style="margin:0; padding:3px; background-color:#336699; filter:progid:DXImageTransform.Microsoft.Alpha(startX=20, startY=20, finishX=100, finishY=100,style=1,opacity=75,finishOpacity=100); opacity:0.75; border:1px solid #336699; height:18px; font:12px Verdana,Geneva,Arial,Helvetica,sans-serif; color:white; cursor:pointer;" onclick="">关闭</h4>
  title.setAttribute("id","msgTitle");
  title.setAttribute("align","right");
  title.style.margin="0";
  title.style.padding="3px";
  title.style.background=titlecolor;
  title.style.filter="progid:DXImageTransform.Microsoft.Alpha(startX=20, startY=20, finishX=100, finishY=100,style=1,opacity=75,finishOpacity=100);";
  title.style.opacity="0.75";
  title.style.border="1px solid " + titlecolor;
  title.style.height="18px";
  title.style.font="12px Verdana, Geneva, Arial, Helvetica, sans-serif";
  title.style.color="gray";
  title.style.cursor="pointer";
  title.innerHTML="<img src='/images/enqing-logo.png'> [关闭]";
  title.onclick=removeObj;

  function removeObj(){//点击标题栏触发的事件
    document.body.removeChild(bgObj);//删除背景层Div
    document.getElementById("msgDiv").removeChild(title);//删除提示框的标题栏
    document.body.removeChild(msgObj);//删除提示框层
    document.body.scroll="auto"; //恢复滚动
  }
  
  document.body.appendChild(msgObj);//在body内添加提示框div对象msgObj
  document.getElementById("msgDiv").appendChild(title);//在提示框div中添加标题栏对象title
  var content=document.createElement("div");//创建一个p对象（提示框提示信息）
  //定义p的属性，即相当于
  //<p style="margin:1em 0;" id="msgTxt">测试效果</p>
  content.style.margin="1em 0"
  content.setAttribute("id","msgTxt");
  content.innerHTML=str;//来源于函数调用时的参数值
  document.getElementById("msgDiv").appendChild(content);//在提示框div中添加提示信息对象txt
  document.body.scroll="no";	
}

function initial_quicknav() {
	var tab1 = $('hot_tab1');
	var tab2 = $('hot_tab2');
	var tab3 = $('hot_tab3');
	var tab4 = $('hot_tab4');
	
	var tab1_content = $('hot_tab1_content');
	var tab2_content = $('hot_tab2_content');
 	var tab3_content = $('hot_tab3_content');
 	var tab4_content = $('hot_tab4_content');
 	
    //creat morph object
	tab1_content = new Fx.Morph(tab1_content, {
		fps: 60
	});
	tab2_content = new Fx.Morph(tab2_content, {
		fps: 60
	});
	tab3_content = new Fx.Morph(tab3_content, {
		fps: 60
	});
	tab4_content = new Fx.Morph(tab4_content, {
		fps: 60
	});
	 
	tab1.addEvent('click', show_hot_tab_clicked.bind(tab1));
	tab2.addEvent('click', show_hot_tab_clicked.bind(tab2));
	tab3.addEvent('click', show_hot_tab_clicked.bind(tab3));
	tab4.addEvent('click', show_hot_tab_clicked.bind(tab4));
	
	tab1.addEvent('click', show_hot_tab_content.bind(tab1_content));
	tab2.addEvent('click', show_hot_tab_content.bind(tab2_content));
	tab3.addEvent('click', show_hot_tab_content.bind(tab3_content));
	tab4.addEvent('click', show_hot_tab_content.bind(tab4_content));
	
	$('hot_tab1').setStyle('color', 'orange');
	$('hot_tab1_content').setStyle('display', 'block');

}

function initial_search_tab() {
	
	var search_tab1 = $('search_tab1');
	var search_tab2 = $('search_tab2');
	var search_tab3 = $('search_tab3');
	
	var search_tab1_content = $('search_tab1_content');
	var search_tab2_content = $('search_tab2_content');
	var search_tab3_content = $('search_tab3_content');
	
        //creat morph object
	search_tab1_content = new Fx.Morph(search_tab1_content, {
		fps: 60
	});
	search_tab2_content = new Fx.Morph(search_tab2_content, {
		fps: 60
	});
	search_tab3_content = new Fx.Morph(search_tab3_content, {
		fps: 60
	});
	
	search_tab1.addEvent('click', search_tab_clicked.bind(search_tab1));
	search_tab2.addEvent('click', search_tab_clicked.bind(search_tab2));
	search_tab3.addEvent('click', search_tab_clicked.bind(search_tab3));
	
	search_tab1.addEvent('click', search_tab_content.bind(search_tab1_content));
	search_tab2.addEvent('click', search_tab_content.bind(search_tab2_content));
	search_tab3.addEvent('click', search_tab_content.bind(search_tab3_content));
	
	$('search_tab1').setStyles({'border': '1px solid orange', 'border-bottom': "none", 'color': 'orange'});
	$('search_tab1_content').setStyle('display', 'block');	
	
}


var show_tab_content = function() {
        //resets all the styles before it morphs the current one
	$$('.hidden').setStyles({
		'display': 'none',
		'opacity': 0
	});
 
        //here we start the morph and set the styles to morph to
	this.start({
		'display': 'block',
		'opacity': 1
	});
} 


var show_tab_clicked = function() {    
	$$('.unclicked').setStyles({
		'border': '1px solid #d0d3d4',
		'border-bottom': 'none',
		'color': '#d0d3d4'
	});
 
	this.setStyles({
		'border': '1px solid orange',
		'border-bottom': 'none',
		'color': 'orange'
	});
} 

var search_tab_content = function() {
        //resets all the styles before it morphs the current one
	$$('.search_hidden').setStyles({
		'display': 'none',
		'opacity': 0
	});
 
        //here we start the morph and set the styles to morph to
	this.start({
		'display': 'block',
		'opacity': 1
	});
} 


var search_tab_clicked = function() {    
	$$('.search_unclicked').setStyles({
		'border': '1px solid #d0d3d4',
		'border-bottom': 'none',
		'color': '#d0d3d4'
	});
 
	this.setStyles({
		'border': '1px solid orange',
		'border-bottom': 'none',
		'color': 'orange'
	});
}

var show_hot_tab_content = function() {
        //resets all the styles before it morphs the current one
	$$('.hot_hidden').setStyles({
		'display': 'none',
		'opacity': 0
	});
 
        //here we start the morph and set the styles to morph to
	this.start({
		'display': 'block',
		'opacity': 1
	});
} 


var show_hot_tab_clicked = function() {    
	$$('.hot_unclicked').setStyles({
		'color': '#cac6c0'
	});
 
	this.setStyles({
		'color': 'orange'
	});
}

function check_blank(id, message) {
	if($(id).value == ""){
		alert(message);
		return false;
	}
	else{
		return true;
	}
}

function set_page_title(title) {
	kdocTitle = document.title;//标题 
	if(kdocTitle == null){ 
    	var t_titles = $$("title") 
    	if(t_titles && t_titles.length >0) { 
       		t_titles[0] = title; 
    	}
	}else{
		document.title = title;
	}
}

