//showHide()
function showHide (id,ident,tot_id) {
	for (i=1;i<=tot_id;i++) {
		document.getElementById(id + i).style.display = 'none';
	}
	document.getElementById(id + ident).style.display = '';
}

function hide( targetId ){
 	 if (document.getElementById){
  		target = document.getElementById( targetId );
  				target.style.visibility = "hidden";
  			}
  		}

function show( targetId ){
 	 if (document.getElementById){
  		target = document.getElementById( targetId );
  				target.style.visibility = "visible";
  			}
  		}

function turnOn( targetId ){
 	 if (document.getElementById){
  		target = document.getElementById( targetId );
  		if (target.style.display =="block") {
  			target.style.display = "none";
  		}
  		else {
			target.style.display = "block";
		}
	}
}

function turnOnBtskill( targetId ){
 	 if (document.getElementById){
  		target = document.getElementById( targetId );
  		if (target.style.display =="block") {
  			target.style.display = "none";
  		}
  		else {
			target.style.display = "block";
		}
		a = document.getElementById("btskill");
		if(a.style.backgroundImage != "url(/images/panduan/profesi/bt_skill_on.gif)"){
			a.style.backgroundImage = "url(/images/panduan/profesi/bt_skill_on.gif)";
			
		}
		else {
			a.style.backgroundImage = "url(/images/panduan/profesi/bt_skill_off.gif)";
		}
		//a.style.backgroundImage = "url(/images/panduan/profesi/bt_skill_on.gif)";
	}
}

function turnOnBtST( targetId ){
 	 if (document.getElementById){
  		target = document.getElementById( targetId );
  		if (target.style.display =="block") {
  			target.style.display = "none";
  		}
  		else {
			target.style.display = "block";
		}
	}
}

/*function changebt( targetId ) {
	if (document.getElementById){
  		target = document.getElementById( targetId );
  		if (target.style.background-image =="url(../images/panduan/profesi/bt_skill_off.gif)") {
  			target.style.background-image ="url(../images/panduan/profesi/bt_skill_on.gif)";
  		}
  		else {
			target.style.background-image ="url(../images/panduan/profesi/bt_skill_off.gif)"
		}
	}
}*/

//cchanger
function cchanger(id,ident,tot_cla) {
	for (i=1;i<=tot_cla;i++) {
		changec(id + i, id + i + '_off');
	}
	changec(id + ident, id + ident + '_on');
}

function mcchanger(id,ident,tot_cla) {
	for (i=2;i<=tot_cla;i++) {
		changec(id + i, id + i + '_off');
	}
	changec(id + ident, id + ident + '_on');
}


//changec
function changec(id, newClass) {
	identity=document.getElementById(id);
	identity.className=newClass;
}



// opera to counter -30 #cal #face margin
var detect = navigator.userAgent.toLowerCase();
var face,total,thestring;

if (checkIt('opera')) {
	document.write("<link REL='stylesheet' HREF='/css/opera.css' TYPE='text/css'>");
}


function checkIt(string) {
	place = detect.indexOf(string) + 1;
	thestring = string;
	return place;
}




function rndquote() {
	var text_st = new Array(


"Isilah data-data ID kamu dengan benar.",
"Kode PIN harus diingat baik-baik.",
"Jangan berbagi ID dengan orang lain."

	);
	
	var l = text_st.length;
	
	var rnd_no = Math.round((l-1)*Math.random());
	document.write(text_st[rnd_no]);
}

//BUKA WIN
function bukawin(bookURL,j_width,j_height,j_scroll, j_name){
    var winTop,winLeft;
    if (j_name=="" || j_name==null){
        j_name='b';
    }
	if(j_scroll=="" || j_scroll==null){
		j_scroll="yes";
	}
	if(j_width>screen.width){
		winLeft=0;
	}else{
		winLeft=(screen.width-j_width)/2;
	}
	if(j_height>screen.height){
		winTop=0;
	}else{
		winTop=(screen.height-j_height)/2;
	}
	var winFeat = "menubar=no,scrollbars="+j_scroll+",status=no,toolbar=no,height="+j_height+",width="+j_width;
	winFeat = winFeat+",top="+winTop+",left="+winLeft;
	var newWin = window.open(bookURL,j_name,winFeat);
	newWin.focus()
}

// IMG POP

PositionX = 100;
PositionY = 100;

defaultWidth  = 500;
defaultHeight = 500;

var AutoClose = true;

if (parseInt(navigator.appVersion.charAt(0))>=4){
var isNN=(navigator.appName=="Netscape")?1:0;
var isIE=(navigator.appName.indexOf("Microsoft")!=-1)?1:0;}
var optNN='scrollbars=no,width='+defaultWidth+',height='+defaultHeight+',left='+PositionX+',top='+PositionY;
var optIE='scrollbars=no,width=150,height=100,left='+PositionX+',top='+PositionY;
function popImage(imageURL,imageTitle){
if (isNN){imgWin=window.open('about:blank','',optNN);}
if (isIE){imgWin=window.open('about:blank','',optIE);}

with (imgWin.document) {
	writeln('<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">');
	writeln('<html>');
	writeln('<head>');
	writeln('<title>SEAL Online Indonesia</title>');
	writeln('<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">');
	writeln('<sc'+'ript type="text/javasc'+'ript">');
	writeln('<!--');
	writeln('// Shape me');
	writeln('var isNN,isIE;');
	writeln('if (parseInt(navigator.appVersion.charAt(0))>=4){');
	writeln('	isNN=(navigator.appName=="Netscape")?1:0;');
	writeln('	isIE=(navigator.appName.indexOf("Microsoft")!=-1)?1:0;}');
	writeln('function reSizeToImage()');
	writeln('{');
	writeln('	if (isIE)');
	writeln('	{');
	writeln('		window.resizeTo(100,100);');
	writeln('		width=100-(document.body.clientWidth-document.images[0].width);');
	writeln('		height=100-(document.body.clientHeight-document.images[0].height);');
	writeln('		window.resizeTo(width,height);');
	writeln('	}');
	writeln('	if (isNN)');
	writeln('	{');
	writeln('		window.innerWidth=document.images["Seal"].width;');
	writeln('		window.innerHeight=document.images["Seal"].height;');
	writeln('	}');
	writeln('}');
	writeln('function doTitle(){document.title="'+imageTitle+'";');
	writeln('}');
	writeln('// Close me');
	writeln('function IE(e) ');
	writeln('{');
	writeln('     if (isIE && (event.button == 2 || event.button == 3))');
	writeln('     {');
	writeln('          self.close();');
	writeln('          return false;');
	writeln('     }');
	writeln('}');
	writeln('function NS(e) ');
	writeln('{');
	writeln('     if (document.layers || (document.getElementById && !document.all))');
	writeln('     {');
	writeln('          if (e.which==2 || e.which==3)');
	writeln('          {');
	writeln('               self.close();');
	writeln('               return false;');
	writeln('          }');
	writeln('     }');
	writeln('}');
	writeln('document.onmousedown=IE;document.onmouseup=NS;document.oncontextmenu=new Function("self.close();");');
	writeln('-->');	
	writeln('</sc'+'ript>');
	writeln('</head>');
	writeln('<body style="margin: 0;" onload="reSizeToImage(); doTitle(); self.focus()">');
	writeln('<a href="j#" onclick="javascript: onclick=self.close();return false;"><img name="Seal" src='+imageURL+' style="display:block;border:0"></a>');
	writeln('</body>');
	writeln('</html>');
	close();		
	}
}

function addLoadEvent(func) {
  var oldonload = window.onload;
  if (typeof window.onload != 'function') {
    window.onload = func;
  } else {
    window.onload = function() {
      if (oldonload) {
        oldonload();
      }
      func();
    }
  }
}

function getElementsByClass(searchClass,node,tag) {
	var classElements = new Array();
	if ( node == null )
		node = document;
	if ( tag == null )
		tag = '*';
	var els = node.getElementsByTagName(tag);
	var elsLen = els.length;
	var pattern = new RegExp("(^|\s)"+searchClass+"(\s|$)");
	for (i = 0, j = 0; i < elsLen; i++) {
		if ( pattern.test(els[i].className) ) {
			classElements[j] = els[i];
			j++;
		}
	}
	return classElements;
}

var bustcachevar=1 //bust potential caching of external pages after initial request? (1=yes, 0=no)
var loadstatustext="<div class='loading'><img src='/images/loading.gif' /> Tunggu sebentar yach...</div>"

////NO NEED TO EDIT BELOW////////////////////////
var loadedobjects=""
var defaultcontentarray=new Object()
var bustcacheparameter=""

function ajaxpage(url, containerid, targetobj){
	var page_request = false
	if (window.XMLHttpRequest) // if Mozilla, Safari etc
		page_request = new XMLHttpRequest()
	else if (window.ActiveXObject){ // if IE
		try {
			page_request = new ActiveXObject("Msxml2.XMLHTTP")
		} 
		catch (e){
			try{
				page_request = new ActiveXObject("Microsoft.XMLHTTP")
			}
			catch (e){}
		}
	}
	else
		return false
	var ullist=targetobj.parentNode.parentNode.getElementsByTagName("li")
	for (var i=0; i<ullist.length; i++)
		ullist[i].className=""  //deselect all tabs
	targetobj.parentNode.className="selected"  //highlight currently clicked on tab
	if (url.indexOf("#default")!=-1){ //if simply show default content within container (verus fetch it via ajax)
		document.getElementById(containerid).innerHTML=defaultcontentarray[containerid]
		return
	}
	document.getElementById(containerid).innerHTML=loadstatustext
	page_request.onreadystatechange=function(){
		loadpage(page_request, containerid)
	}
	if (bustcachevar) //if bust caching of external page
		bustcacheparameter=(url.indexOf("?")!=-1)? "&"+new Date().getTime() : "?"+new Date().getTime()
	page_request.open('GET', url+bustcacheparameter, true)
	page_request.send(null)
}

function loadpage(page_request, containerid){
	if (page_request.readyState == 4 && (page_request.status==200 || window.location.href.indexOf("http")==-1))
		document.getElementById(containerid).innerHTML=page_request.responseText
}

function loadobjs(revattribute){
	if (revattribute!=null && revattribute!=""){ //if "rev" attribute is defined (load external .js or .css files)
		var objectlist=revattribute.split(/\s*,\s*/) //split the files and store as array
		for (var i=0; i<objectlist.length; i++){
			var file=objectlist[i]
			var fileref=""
			if (loadedobjects.indexOf(file)==-1){ //Check to see if this object has not already been added to page before proceeding
				if (file.indexOf(".js")!=-1){ //If object is a js file
					fileref=document.createElement('script')
					fileref.setAttribute("type","text/javascript");
					fileref.setAttribute("src", file);
				}
				else if (file.indexOf(".css")!=-1){ //If object is a css file
					fileref=document.createElement("link")
					fileref.setAttribute("rel", "stylesheet");
					fileref.setAttribute("type", "text/css");
					fileref.setAttribute("href", file);
				}
			}
			if (fileref!=""){
				document.getElementsByTagName("head").item(0).appendChild(fileref)
				loadedobjects+=file+" " //Remember this object as being already added to page
			}
		}
	}
}

function savedefaultcontent(contentid){// save default ajax tab content
	if (typeof defaultcontentarray[contentid]=="undefined") //if default content hasn't already been saved
	defaultcontentarray[contentid]=document.getElementById(contentid).innerHTML
}

function starttabs(){
	for (var i=0; i<arguments.length; i++){ //loop through passed UL ids
		var ulobj=document.getElementById(arguments[i])
		var ulist=ulobj.getElementsByTagName("li") //array containing the LI elements within UL
		for (var x=0; x<ulist.length; x++){ //loop through each LI element
			var ulistlink=ulist[x].getElementsByTagName("a")[0]
			if (ulistlink.getAttribute("rel")){
				var modifiedurl=ulistlink.getAttribute("href").replace(/^http:\/\/[^\/]+\//i, "http://"+window.location.hostname+"/")
				ulistlink.setAttribute("href", modifiedurl) //replace URL's root domain with dynamic root domain, for ajax security sake
				savedefaultcontent(ulistlink.getAttribute("rel")) //save default ajax tab content
				ulistlink.onclick=function(){
					ajaxpage(this.getAttribute("href"), this.getAttribute("rel"), this)
					loadobjs(this.getAttribute("rev"))
					return false
				}
				if (ulist[x].className=="selected"){
					ajaxpage(ulistlink.getAttribute("href"), ulistlink.getAttribute("rel"), ulistlink) //auto load currenly selected tab content
					loadobjs(ulistlink.getAttribute("rev")) //auto load any accompanying .js and .css files
				}
			}
		}
	}
}

function findBT(btnID,what,width,height){
	var btn;
	btn=document.getElementById(btnID);
	btn.onclick = function() {
		window.open(what, 'ACS', 'width='+width+',height='+height+'');return(false);
	}
}

function popups(btnClass,left,top,width,height) {
  if (document.getElementsByTagName) {
    var links = document.getElementsByTagName("a");
    for (var i=0; i < links.length; i++) {
      if (links[i].className.match(btnClass)) {
        links[i].onclick = function() {
          window.open(this.getAttribute("href"), 'ACS', 'statusbar=no,menubar=no,toolbar=no,scrollbars=no,resizable=yes, left='+left+',top='+top+',width='+width+',height='+height+'');
          return false;
        };
      }
    }
  }
}