function findPos(obj) {
	var pos = new Array();
	if (obj.offsetParent) {
		pos[0] = obj.offsetLeft;
		pos[1] = obj.offsetTop;
		while (obj = obj.offsetParent) {
			pos[0] += obj.offsetLeft;
			pos[1] += obj.offsetTop;
		}
	}
	return pos;
}
function GetXmlHttpOBJ(){ 
	var objXMLHttp=null;
	if (window.XMLHttpRequest) objXMLHttp=new XMLHttpRequest();
	else if (window.ActiveXObject)	objXMLHttp=new ActiveXObject('Microsoft.XMLHTTP');
	return objXMLHttp;
}
function setCookie(name,value,expires,path){
	var today = new Date();
	today.setTime( today.getTime());
	if ( expires )	expires = expires * 1000 * 60 * 60 * 24;
	var expires_date = new Date( today.getTime() + (expires) );
	document.cookie = name+'='+escape( value ) + ( ( expires ) ? ';expires='+expires_date.toGMTString() : '' ) + ( ( path ) ? ';path=' + path : '' );
}
function getCookie(name) {
	var nameEQ = name + "=";
	var ca = document.cookie.split(';');
	for(var i=0;i < ca.length;i++) {
		var c = ca[i];
		while (c.charAt(0)==' ') c = c.substring(1,c.length);
		if (c.indexOf(nameEQ) == 0) return c.substring(nameEQ.length,c.length);
	}
	return null;
}
function deleteCookie(name) {
	setCookie(name,"",-1);
}
function ElmWidth(obj){
	if(obj.clientWidth) return obj.clientWidth;
	else return obj.offsetWidth;
}
function ElmHeight(obj){
	if(obj.clientHeight) return obj.clientHeight;
	else return obj.offsetHeight;
}
function setOpacity(Obj,opacity) {
	Obj.style.opacity = (opacity / 100);
	Obj.style.MozOpacity = (opacity / 100);
	Obj.style.KhtmlOpacity = (opacity / 100);
	Obj.style.filter = "alpha(opacity=" + opacity + ")";
}
function getavailHeight() {
  if( typeof( window.innerHeight ) == 'number' )	var y = window.innerHeight;
  else if( document.documentElement && document.documentElement.clientHeight) var y = document.documentElement.clientHeight;
  return y;
}
function getavailWidth() {
  if( typeof( window.innerWidth ) == 'number' )	var x = window.innerWidth;
  else if( document.documentElement && document.documentElement.clientWidth) var x = document.documentElement.clientWidth;
  return x;
}
function getscrollTop(){
   var h = window.pageYOffset || document.body.scrollTop || document.documentElement.scrollTop;          
   return h ? h : 0;
}
function getscrollLeft(){
   var l = window.pageXOffset || document.body.scrollLeft || document.documentElement.scrollLeft;          
   return l ? l : 0;
}
var mposx = 0;
var mposy = 0;
function mpos(e){
	if(!e) var e = window.event;
	if(e.pageX || e.pageY){
		mposx = e.pageX;
		mposy = e.pageY;
	}else if(e.clientX || e.clientY){
		mposx = e.clientX + document.body.scrollLeft + document.documentElement.scrollLeft;
		mposy = e.clientY + document.body.scrollTop + document.documentElement.scrollTop;
	}
}
function selectedText(){
	if (document.getSelection)	var str = document.getSelection();
	else if (document.selection && document.selection.createRange)	var str = document.selection.createRange().text;
	return str;
}
function trim(str){ 
	while (str.substring(0,1) == ' '){ 
		str = str.substring(1, str.length); 
	} 
	while (str.substring(str.length-1, str.length) == ' '){ 
		str = str.substring(0,str.length-1); 
	} 
	return str; 
}
Array.prototype.in_array = function(p_val) {
	for(var i = 0, l = this.length; i < l; i++) {
		if(this[i] == p_val) {
			return true;
		}
	}
	return false;
}
function $(val){
	return document.getElementById(val);
}
//made by jason//
var group_x = new Array();
var ar_r = new Array();
function ss(val){
	group_x = new Array();
	val = trim(val);
	ar_r = val.split(" ");
	if(val.substr(0,1)!="#"){
		switched(document.body,0);	
	}else{
		if(ar_r.length>1) switched($(ar_r[0].substr(1)),1);
		else group_x.push($(ar_r[0].substr(1)));
	} 
	return group_x;	
}
function ww(obj,val){
	group_x = new Array();	
	val = trim(val);
	ar_r = val.split(" ");
	switched(obj,0);
	return group_x;		
}
function switched(obj,val){
	var text = ar_r[val];
	var val_head = text.substr(0,1);
	var val_text = text.substr(1);
	if(val_head==".")	findC(obj,val);
	else if(val_head=='#'){
		if(val==(ar_r.length-1))	group_x.push($(val_text));
		else switched($(val_text),val+1);
	}else if(text)	findE(obj,val);
	else switched(obj,++val);
}
function findC(obj,val){
	var text = ar_r[val].substr(1);
	var i=0;
	var robj = obj.childNodes;
	while(robj[i]){
		if(robj[i].className == text){
			if(val==(ar_r.length-1))	group_x.push(robj[i]);
			else switched(robj[i],val+1);
		}
		switched(robj[i],val);
		i++;
	}	
}
function findE(obj,val){
	var text = ar_r[val].toUpperCase();
	var i=0;
	var robj = obj.childNodes;
	while(robj[i]){
		if(robj[i].nodeName == text){
			if(val==(ar_r.length-1))	group_x.push(robj[i]);
			else switched(robj[i],val+1);
		}
		switched(robj[i],val);
		i++;
	}	
}
function popup(obj, w, h){
	var pop_win = window.open(obj.href,'pop_win','width='+w+', height='+h+', scrollbars=yes');
	pop_win.focus();
	return false;
}
function pop(url, w, h){
	var pop_win = window.open(url,'pop_win','width='+w+', height='+h+', scrollbars=yes');
	pop_win.focus();
	//return false;
}
function openflash(src,width,height){ 
    var text="<object classid=\"clsid:D27CDB6E-AE6D-11cf-96B8-444553540000\" codebase=\"http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,29,0\" width="+width+" height="+height+"><param name=movie value="+src+"><param name=quality value=high ><param name=wmode value=transparent><param name=menu value=false><embed src="+src+" quality=high  pluginspage=\"http://www.macromedia.com/shockwave/download/index.cgi?P1_Prod_Version=ShockwaveFlash\" type=\"application/x-shockwave-flash\" width="+width+" height="+height+"  wmode=transparent menu=false></embed></object>"; 
	document.write(text); 
}
function updateplayer(){
	if(confirm("You need to update your Flash Player. Do you want to update your Flash Player?")){
		location.href = "http://www.adobe.com/shockwave/download/download.cgi?P1_Prod_Version=ShockwaveFlash";
	}
}
//advertiesement
function phpads_deliverActiveX(content){document.write(content);}
var ads_string = '';
function accumulate(banner,client,zone,source,block,capping){
	ads_string += ","+banner+","+client+","+zone+","+source+","+block+","+capping;
}
function viewCount(){
	var xmlHT=GetXmlHttpOBJ();
	ads_string = ads_string.substr(1);
	var url="/adsnew/viewCount.php?string="+ads_string;
	url += '&sid='+Math.random();
	xmlHT.open("GET",url,true);
	xmlHT.send(null);
}
//menu
var original = 0;
var prev = 0;
var sTime;
function setMenu(val){
	original = prev = val;
	menuOver(val);
	$("menuBox").onmouseout = function(){
		if($("menu"+prev)) $("menu"+prev).className += " over";	
		clearTimeout(sTime);
		sTime = setTimeout("menuOut()",1000);
	};
}
function menuOut(){
	if(prev==0) $("menu"+prev).className = "first";
	else if($("menu"+prev)) $("menu"+prev).className = "";
	if($("submenu"+prev)) $("submenu"+prev).style.display = "none";
	if(original==0) $("menu"+original).className = "first over";
	else if($("menu"+original)) $("menu"+original).className = "over";
	if($("submenu"+original)) $("submenu"+original).style.display = "block";
	prev = original;
}
function menuOver(val){
	clearTimeout(sTime);	
	if(prev != original){
		if(prev==0) $("menu"+prev).className = "first";
		else if($("menu"+prev)) $("menu"+prev).className = "";
	}
	if($("submenu"+prev)) $("submenu"+prev).style.display = "none";
	if($("menu"+val)) $("menu"+val).className += " over";	
	if($("submenu"+val)) $("submenu"+val).style.display = "block";
	prev = val;
}
//preview
var setTimes;
var Robj;
var Dcon;
var restrict;
var incon;
var xmlHT;
var Jobj;
function previewOver(obj){
	clearTimeout(setTimes);
	Robj = obj;
	restrict = 0;
	document.onmousemove = mpos;
	setTimes = setTimeout("shows();",500);
	if(Dcon) Dcon.style.display = "none";
}
function previewOut(){
	clearTimeout(setTimes);
	restrict = 1;
	document.onmousemove = null;
	if(Dcon) Dcon.style.display = "none";
}
function shows(){						
	xmlHT=GetXmlHttpOBJ();
	var href = Robj.href.replace(/http:\/\/christianpost.com/gi,'');
	href = href.replace(/http:\/\/www.christianpost.com/gi,'');
	if(Robj.className=="preview") var url="/system/process/article.php?url="+href+"&key=";
	else var url="/public/preview.php?url="+href+"&key=";
	Jobj = Robj;
	xmlHT.onreadystatechange=function(){
		if(xmlHT.readyState==4 || xmlHT.readyState=="complete"){			
			var content = xmlHT.responseText.split("*=*");
			if(content[2]) var contentos = "<img src='"+content[2]+"' />"+content[1];
			else var contentos = content[1];
			if(!restrict && Jobj==Robj){
				if(!Dcon){
					Dcon = document.createElement("div");
					document.body.appendChild(Dcon);
					incon = document.createElement("div");
					Dcon.appendChild(incon);
					incon.id = "innerArt";
					Dcon.id = "nextArticle";
					/*Dcon.onmouseover = function(){
						Dcon.style.display = "block";
					};
					Dcon.onmouseout = function(){
						Dcon.style.display = "none";
					};*/
				}
				Dcon.style.display = "block";
				incon.innerHTML = contentos;
				var sLeft = getscrollLeft();
				var sTop = getscrollTop();
				var Width = Dcon.offsetWidth;
				var Height = Dcon.offsetHeight;
				if((mposx-sLeft+Width+20+13) < getavailWidth())	Dcon.style.left = (mposx+20)+"px";
				else	Dcon.style.left = (sLeft+getavailWidth()-Width-18)+"px";//scrollbar:18		
				if((mposy-sTop+Height+14+18) < getavailHeight())	Dcon.style.top = (mposy+14)+"px";//scrollbar:18
				else if((mposy-Height-14) < sTop)	Dcon.style.top = sTop+"px"; 
				else	Dcon.style.top = (mposy-Height-14)+"px";	
				document.onmousemove = null;				
			}
		}
	}; 
	xmlHT.open("GET",url,true);
	xmlHT.send(null);																				
}
//counter
var aid;
function counter(ip,classify){
	var xmlHT=GetXmlHttpOBJ();
	var url="/system/process/counter.php?ip="+ip;
	url += "&classify="+classify;
	if(aid) url += "&artid="+aid;
	url += '&sid='+Math.random();
	xmlHT.open("GET",url,true);
	xmlHT.send(null);	
}
//tab
function Tab(id){
	var obj = $(id);
	var len = obj.childNodes.length;
	for(var i=0;i<len;i++){
		if(obj.childNodes[i].nodeName=="UL"){ 
			var Sobj = obj.childNodes[i];
			break;
		}
	}
	len = Sobj.childNodes.length;			
	for(var i=0;i<len;i++){
		if(Sobj.childNodes[i].nodeType == 1){
			Sobj.childNodes[i].onmouseover = function(){
				var k = 0;
				for(j=0;j<len;j++){
					if(Sobj.childNodes[j].nodeType == 1){
						if(this != Sobj.childNodes[j]){
							Sobj.childNodes[j].className = "tabTitle";
							$(id+"_tab"+k).style.display = "none";
						}else{
							this.className += " curTab";	
							$(id+"_tab"+k).style.display = "block";
						}
						k++;
					}
				}
			}
		}
	}
}
var tab_name;
var tab_index;
var tabTime;
function TabBar(id,num){
	for(var i=0;i<num;i++){
		$(id+"_menu"+i).onmouseover = function(){
			Tover(this);
		}
		$(id+"_menu"+i).onmouseout = Tout;
	}
}
function Tover(obj){
	clearTimeout(tabTime);
	tab_name = obj.id.substr(0,7);
	tab_index = obj.id.substr(12);
	tabTime = setTimeout("Topen();",300);
}
function Tout(){
	clearTimeout(tabTime);
}
function Topen(){
	var i=0;
	while($(tab_name+"_menu"+i)){
		if(i==tab_index){ 
			$(tab_name+"_menu"+i).className += " curTab";
			$(tab_name+"_tab"+i).style.display = "block";
		}else{ 
			$(tab_name+"_menu"+i).className = "tabTitle";
			$(tab_name+"_tab"+i).style.display = "none";
		}
		i++;
	}
}
function checkSearch(f){
	if(!f.q.value) {alert("Please input the Search Keyword");f.q.focus();return false;}
	if(f.engine[0].checked==true){location.href="/services/search/?term="+f.q.value;return false;} 			
}
function adsfileup(banner,zone){
	var url="http://www.christianpost.com/adsnew/countView.php?banner="+banner;
	url += "&zone="+zone;
	url += '&sid='+Math.random();
	var myImage = new Image();
	myImage.src = url;
}