function SearchPage () {
	var str = document.getElementById("src").value;
	var type = "";
	var obj1 = document.getElementById("s1");
	var obj2 = document.getElementById("s2");
	var obj3 = document.getElementById("s3");
	var obj4 = document.getElementById("s4");
	var obj5 = document.getElementById("s5");
	if (obj1.checked == true) type = obj1.value;
	if (obj2.checked == true) type = obj2.value;
	if (obj3.checked == true) type = obj3.value;
	if (obj4.checked == true) type = obj4.value;
	if (obj5.checked == true) type = obj5.value;

	if (type && str) {
		var url = "content.php?module="+type+"&str="+str;
		window.open(url);
	}
}
function Paging (p) {
	var url = "ajax/promotion.php?page="+p;
	//window.open(url);
	document.getElementById("promo").innerHTML = "<div align='center'><img src=\"images/processing.gif\" /></div>";
	$.get(url, function(data){
	  document.getElementById("promo").innerHTML = data;
	});
}
function vote_result (id, type) {
	var obj1 = document.getElementById("vote1");
	var obj2 = document.getElementById("vote2");
	var val = "";
	if (obj1.checked == true) val = obj1.value;
	if (obj2.checked == true) val = obj2.value;
	if (type == 'view') val = "";
	if ((type == 'view') || (type != 'view' && val)) {
		var url = "ajax/vote.php?id="+id+"&val="+val;
		document.getElementById("voteresult").innerHTML = "<div align='center'><img src=\"images/processing.gif\" /></div>";
		$.get(url, function(data){
		  document.getElementById("voteresult").innerHTML = data;
		  document.getElementById("showresult").innerHTML = "";
		});
	}
}
function board (id) {
	if (id==1) url = "ajax/board_update.php";
	if (id==2) url = "ajax/board_topic.php";
	if (id==3) url = "ajax/modulator.php";
	//window.open(url);
	document.getElementById("webboard_content").innerHTML = "<div align='center'><img src=\"images/processing.gif\" /></div>";
	$.get(url, function(data){
	  document.getElementById("webboard_content").innerHTML = data;
	});
}
function gettab(id,n,name){
	for (i=1;i<=n;i++){
		if (id == i) {
			document.getElementById(name+i).className ='current';
		}else{
			document.getElementById(name+i).className ='';
		}
	}
	if (name == 'p') Paging(id);
	if (name == 'li') board(id);
}

function chklogin () {
	var usr = document.getElementById("username").value;
	var pwd = document.getElementById("password").value;
	if (usr && pwd) {
		var url = "lib/chklogin.php";
		document.getElementById("login_result").innerHTML = "<div align='center'><img src=\"images/processing.gif\" /></div>";
		$.post(url, { user: usr, pwd: pwd},
		function(data){
			if (data == "ok") {
				location.href='main.php';
			} else {
				document.getElementById("login_result").innerHTML = data;
			}
		});
	}
}

function chklogin_realteam (id,mod) {
	var usr = document.getElementById("username2").value;
	var pwd = document.getElementById("password2").value;
	var m = "";
	m = (mod)? mod: 'realteam_regist';
	if (usr && pwd) {
		var url = "lib/chklogin.php";
		document.getElementById("login_result").innerHTML = "<div align='center'><img src=\"images/processing.gif\" /></div>";
		$.post(url, { user: usr, pwd: pwd, type: 1},
		function(data){
			if (data == "ok") {
				location.href='content.php?module='+m+'&id='+id;
			} else {
				document.getElementById("login_result2").innerHTML = data;
			}
		});
	}
}

function PopupCenter(pageURL, title,w,h) {
	var left = (screen.width/2)-(w/2);
	var top = (screen.height/2)-(h/2);
	var targetWin = window.open (pageURL, title, 'toolbar=no, location=no, directories=no, status=no, menubar=no, scrollbars=yes, resizable=no, copyhistory=no, width='+w+', height='+h+', top='+top+', left='+left);
}