<?php

//样式表 

function PageGlobal($pagename){

	global $msql,$tbl_page,$nowmenuid;
	global $BodyStyle,$TdStyle,$NavStyle,$InputStyle,$ButtonStyle,$PagesStyle,$TableStyle,$TitleStyle,$ConStyle;
	global $PageLeftTempFile,$PageRightTempFile,$PageConTempFile,$PageAllTempFile,$PageBlankTempFile;
 
	$msql->query("select * from $tbl_page where menuid='$nowmenuid' and pagename='$pagename'");
	if($msql->next_record()){
		$pagetype=$msql->f('pagetype');
		$BodyStyle=$msql->f('BodyStyle');
	    $TdStyle=$msql->f('TdStyle');
	    $NavStyle=$msql->f('NavStyle');
	    $InputStyle=$msql->f('InputStyle');
	    $ButtonStyle=$msql->f('ButtonStyle');
	    $TableStyle=$msql->f('TableStyle');
	    $TitleStyle=$msql->f('TitleStyle');
	    $ConStyle=$msql->f('ConStyle');
		$PagesStyle=$msql->f('PagesStyle');

	}


$PageGlobal[0]="<style>
BODY {".$BodyStyle."}  
TD,A,P {".$TdStyle."}
.nav {".$NavStyle."} 
.table {".$TableStyle."}
.title {".$TitleStyle."}
.con {".$ConStyle."}
.pages {".$PagesStyle."}
.input {".$InputStyle."}
.button {".$ButtonStyle."}
SELECT {font-size: 12px;}
A:link {TEXT-DECORATION: none;}
A:visited {TEXT-DECORATION: none;}
A:active {TEXT-DECORATION: none;}
A:hover {TEXT-DECORATION: none;}
</style>";

switch($pagetype){

	case "page-left" :
		$PageGlobal[1]="$PageLeftTempFile";
	break;
	case "page-right" :
		$PageGlobal[1]="$PageRightTempFile";
	break;
	case "page-con" :
		$PageGlobal[1]="$PageConTempFile";
	break;
	case "page-all" :
		$PageGlobal[1]="$PageAllTempFile";
	break;
	case "page-blank" :
		$PageGlobal[1]="$PageBlankTempFile";
	break;

}

	return $PageGlobal;
}

//样式表 

function GlobalStyle(){

	global $BodyStyle,$TdStyle,$NavStyle,$InputStyle,$ButtonStyle,$PagesStyle,$TableStyle,$TitleStyle,$ConStyle;


$PageStyle="<style>
BODY {".$BodyStyle."}  
TD,A,P {".$TdStyle."}
.nav {".$NavStyle."} 
.table {".$TableStyle."}
.title {".$TitleStyle."}
.con {".$ConStyle."}
.pages {".$PagesStyle."}
.input {".$InputStyle."}
.button {".$ButtonStyle."}
SELECT {font-size: 12px;}
A:link {TEXT-DECORATION: none;}
A:visited {TEXT-DECORATION: none;}
A:active {TEXT-DECORATION: none;}
A:hover {TEXT-DECORATION: none;}
</style>";



	return $PageStyle;
}

//左中右位置样式
function ReadLocatStyle($nowmenuid,$pagename){

	global $msql,$tbl_page_locat,$PageLeft,$PageRight,$PageMain;
	$msql->query("select * from $tbl_page_locat where  menuid='$nowmenuid' and page='$pagename'");
	while($msql->next_record()){
		$locat=$msql->f('locat');
		$style=$msql->f('style');
		switch($locat){
			
			case "left":
				if($style!="" && strlen($style)>5){
					$PageLeft="<table cellspacing=0 cellpadding=0 width=100% height=100%><tr><td valign=top style='".$style."'>".$PageLeft."</td></tr></table>";
				}
			break;
			case "center":
				if($style!="" && strlen($style)>5){
					$PageMain="<table cellspacing=0 cellpadding=0 width=100% height=100%><tr><td valign=top style='".$style."'>".$PageMain."</td></tr></table>";
				}
			break;
			case "right":
				if($style!="" && strlen($style)>5){
					$PageRight="<table cellspacing=0 cellpadding=0 width=100% height=100%><tr><td valign=top style='".$style."'>".$PageRight."</td></tr></table>";
				}
			break;


		}
	}
}

//页头
function PageHeader(){

	global $PageTitle,$PageMetakey,$PageMetacon,$PageStyle;

	$PageHead="<html><head>\n<title>".$PageTitle."</title>\n";
	$PageHead.="<meta http-equiv='Content-Type' content='text/html; charset=gb2312'>\n";
	$PageHead.="<META content=".$PageMetakey." name=keywords>\n";
	$PageHead.="<META content=".$PageMetacon." name=description>\n";
	$PageHead.=$PageStyle;
	$PageHead.="\n</head>\n<body leftmargin=0 topmargin=0 marginwidth=0 marginheight=0>";

	return $PageHead;

}

//页尾
function PageEnd(){
	
	global $nowmenuid,$CommonPath;
	include_once($CommonPath."/func/advs.inc.php");
	$PageEnd.=ShowPop($nowmenuid);
    $PageEnd.=ShowFloat($nowmenuid);
    $PageEnd.=ShowDuilian($nowmenuid);
	$PageEnd.=ShowLeftConer($nowmenuid);
	$PageEnd.=ShowRightConer($nowmenuid);
	$PageEnd.="</body></html>";

	return $PageEnd;

}

?>