//跳转
function Location_button(url){
	document.location.href = url;
}
//提交表单
function Query_button(obj,Fname){
	document[Fname].submit();
	obj.disabled = true;
}
//保存
function Save_button(obj,Fname){
	document[Fname].cmd.value = 'save';
	obj.disabled = true;
	document[Fname].submit();
}
//分页
function page(Fname,p){
	document[Fname].page.value = p;
	document[Fname].submit();
}
function change_page(Fname){
	var el = document.getElementById("page_select");
	if(el != null){
		for(i=0;i<el.options.length;i++){
			if( el.options(i).selected ){
				var pager = el.options(i).value;
				document[Fname].page.value = pager;
				document[Fname].submit();
			}
		}
	}
}
//删除
function Delete_check(Fname,field,id) {
	res = confirm("真的要删除这条记录吗?");
	if (res == true) {
		obj = document[Fname];
		obj.cmd.value = "delete";
		obj[field].value = id;
		document[Fname].submit();
	}
}
function SEO_Default(obj,lang){
	if( lang == "ch" ){
		seo_title 		= document.getElementById("seo_title");
		seo_keywords 	= document.getElementById("seo_keywords");
		seo_description = document.getElementById("seo_description");
		if( seo_title.value == '' ){
			seo_title.value = obj.value;
		}
		if( seo_keywords.value == '' ){
			seo_keywords.value = obj.value;
		}
		if( seo_description.value == '' ){
			seo_description.value = obj.value;
		}
	}
	if( lang == "en" ){
		seo_title_en 		= document.getElementById("seo_title_en");
		seo_keywords_en 	= document.getElementById("seo_keywords_en");
		seo_description_en = document.getElementById("seo_description_en");
		if( seo_title_en.value == '' ){
			seo_title_en.value = obj.value;
		}
		if( seo_keywords_en.value == '' ){
			seo_keywords_en.value = obj.value;
		}
		if( seo_description_en.value == '' ){
			seo_description_en.value = obj.value;
		}
	}
}
/*收藏*/
function Collection(type,obj_id){
	$.ajax({
		type: "POST",
		url: "ajax_collection.php",
		data:"type="+type+"&obj_id="+obj_id,
		success: function(msg){ alert(msg); } 
	});
}

function showtime(flg)
{
	var today,hour,second,minute,year,month,date;
	var strDate ;
	   today=new Date();
	 var n_day = today.getDay();
	 switch (n_day)
	 {
		 case 0:{
		 	strDate = "星期日"
		 }break;
		 case 1:{
		 	strDate = "星期一"
		 }break;
		 case 2:{
		 	strDate = "星期二"
		 }break;
		 case 3:{
		 	strDate = "星期三"
		 }break;
		 case 4:{
		 	strDate = "星期四"
		 }break;
		 case 5:{
		 	strDate = "星期五"
		 }break;
		 case 6:{
		 	strDate = "星期六"
		 }break;
		 case 7:{
		 	strDate = "星期日"
		 }break;
	 }
	var year	= today.getFullYear();
	var month	= today.getMonth()+1;
	var date	= today.getDate();
	var hour	= today.getHours();
	var minute	= today.getMinutes();
	var second	= today.getSeconds();
	
    if(month<10){	month	="0" + month; }
    if(date<10){	date	="0" + date; }
    if(hour<10){	hour	="0" + hour; }
    if(minute<10){	minute	="0" + minute; }
    if(second<10){	second	="0" + second; }
	
	if( flg == "time" ){
		document.getElementById('time').innerHTML = year + "年" + month + "月" + date + "日 " + strDate +" " + hour + ":" + minute + ":" + second; //显示时间
		setTimeout("showtime();", 1000); //设定函数自动执行时间为 1000 ms(1s)
	}else{
		document.getElementById('time').innerHTML = year + "年" + month + "月" + date + "日 " + strDate; //显示时间
	}
}

function ImageMovie(){
  this.width=100;
  this.height=100;
  this.textHeight=20;
  this.flashHeight=0;
  this.pics='';
  this.links='';
  this.texts='';

  this.add=function(pic,link,text){
	  if(this.pics!='')this.pics+='|';
	  this.pics+=pic;

	  if(this.links!='')this.links+='|';
	  this.links+=link;

	  if(this.texts!='')this.texts+='|';
	  this.texts+=text;
  }

  this.play = function(){
    this.flashHeight=this.height + this.textHeight;
	document.writeln('<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="'+ this.width +'" height="'+ this.flashHeight +'">');
	document.writeln('<param name="allowScriptAccess" value="sameDomain">');
	document.writeln('<param name="movie" value="images/focus.swf">');
	document.writeln('<param name="quality" value="high">');
	document.writeln('<param name="bgcolor" value="#FFFFFF">');
	document.writeln('<param name="menu" value="false">');
	document.writeln('<param name=wmode value="Opaque">');
	document.writeln('<param name="FlashVars" value="pics='+this.pics+'&links='+this.links+'&texts='+this.texts+'&borderwidth='+this.width+'&borderheight='+this.height+'&textheight='+this.textHeight+'">');
	document.writeln('<embed src="images/focus.swf" wmode="Opaque" FlashVars="texts='+this.texts+'&pics='+this.pics+'&links='+this.links+'&borderwidth='+this.width+'&borderheight='+this.height+'&textheight='+this.textHeight+'" menu="false" bgcolor="#FFFFFF" quality="high" width="'+ this.width +'" height="'+ this.flashHeight +'" allowScriptAccess="sameDomain" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" />');
    document.writeln('</object>');
  }
}












