
ns=(document.layers);
ie=(document.all);
w3=(document.getElementById && !ie);

function setElement(settleid,show){
	if(ie){                adDiv=eval('document.all.'+settleid+'.style');}
	else if(ns){        adDiv=eval('document.layers["'+settleid+'"]');}
	else if(w3){        adDiv=eval('document.getElementById("'+settleid+'").style');}
	if(show == true){
		showAd();
	}else{
		closeAd();
	}
}

function showAd(){
        if (ie||w3){
        	adDiv.visibility="visible";
        	adDiv.display = "";
        }else{
        	adDiv.visibility ="show";
        }
        if (ie){
       	 documentWidth  =document.body.offsetWidth/2+document.body.scrollLeft-20;
       	 documentHeight =document.body.offsetHeight/2+document.body.scrollTop-20;}
        else if (ns){
       	 documentWidth=window.innerWidth/2+window.pageXOffset-20;
        	documentHeight=window.innerHeight/2+window.pageYOffset-20;}
        else if (w3){documentWidth=self.innerWidth/2+window.pageXOffset-20;
       	 documentHeight=self.innerHeight/2+window.pageYOffset-20;}
        	adDiv.left=documentWidth-310;
        	adDiv.top =documentHeight-160;
}

function closeAd(){
	if (ie||w3){
		adDiv.visibility="hidden";
		adDiv.display="none";
	}else{
		adDiv.visibility ="hide";
	}
}

function randomBackground()
{
	var b = document.body;
	var bg = ['bground2.jpg','bground3.jpg'];

	if(b)
	{
		b.style.backgroundImage = "url('template/default/images/"+bg[(Math.floor(Math.random()*bg.length))]+"')";
	}
	else
		setTimeout(randomBackground,500);
}

function flashshow(add,w,h,id,bg){
var flashStr=
"<object classid='clsid:d27cdb6e-ae6d-11cf-96b8-444553540000' codebase='http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=8,0,0,0' width='"+w+"' height='"+h+"' id='"+id+"' align='middle'>"+
"<param name='allowScriptAccess' value='always' />"+
"<param name='movie' value='"+add+"' />"+
"<param name='menu' value='false' />"+
"<param name='quality' value='high' />"+
"<param name='bgcolor' value='"+bg+"' />"+
"<param name='wmode' value='transparent' />"+
"<embed src='"+add+"' menu='false' quality='high' wmode='transparent' bgcolor='"+bg+"' width='"+w+"' height='"+h+"' id='"+id+"' align='middle' allowScriptAccess='always' type='application/x-shockwave-flash' pluginspage='http://www.macromedia.com/go/getflashplayer' />"+
"</object>";
document.write(flashStr);
}

tab_news = 0;

function main_news_tab(tab)
{
	var newstb = document.getElementById('news_head');
	var news_tab = new Array();
	var news_img = new Array();
	var news_act = new Array();

	news_tab[0] = document.getElementById('berita');
	news_tab[1] = document.getElementById('promosi');
	news_tab[2] = document.getElementById('sistem');
	news_img[0] = 'images/tab_berita.jpg';
	news_img[1] = 'images/tab_promosi.jpg';
	news_img[2] = 'images/tab_sistem.jpg';
	news_act[0] = 'berita';
	news_act[1] = 'promosi';
	news_act[2] = 'sistem';

	for(i=0;i<3;i++) {
		news_tab[i].setAttribute('className', 'news_tab');
		news_tab[i].setAttribute('class', 'news_tab');
		if(i == tab) {
			news_tab[i].setAttribute('className', 'news_selected_tab');
			news_tab[i].setAttribute('class', 'news_selected_tab');
			if(tab != tab_news) {
				var img = news_img[i];
				document.getElementById('news_tabcontent').innerHTML = '<img src="images/loading.gif" border="0" align="left" style="margin: 0px 6px;" /> Data sistem sedang dibaca, sila tunggu sebentar...';
				newstb.setAttribute('style', "background-image:url('"+img+"');");
				newstb.style.backgroundImage = "url('"+img+"')";
				xajax.$('tabType').value = news_act[i];
				xajax.$('myField').value = 'newstab';
				xajax_process(xajax.getFormValues('newsForm'));
				tab_news = tab;
			}
		}
	}
	return false;
}