// JavaScript Document
function keterangan()
{
	var date = new Date();
	var browser=navigator.appName;
	var b_version=navigator.appVersion;
	var version=parseFloat(b_version);
	document.onmousedown = click;
	window.status="Selamat Datang di Pusat Sistem Informasi Mikroskil";
	date.setFullYear(date.getYear()+1900,date.getMonth(),date.getDate());
	document.getElementById('waktu').innerHTML=date + " [" + browser + " " + version + "]";
		
	t=setTimeout('keterangan()',500);
	function peringatan(n) 
	{
		if (parent.moveBy) 
		{
			for (ii = 23; ii > 0; ii--) 
			{
				for (ij = n; ij > 0; ij--) 
				{
					parent.moveBy(0,-ii);
					parent.moveBy(-ii,0);
					parent.moveBy(0,ii);
					parent.moveBy(ii,0);
         		}
      		}
   		}
	}
	function click() 
	{
		time=0
		if ((event.button == 2) || (event.button == 3))
		{
			//alert("You're not permitted to view source from Mikroskil");
			//peringatan(23)
		}
	}
}
function go(dest) 
{
window.location= dest;
}
function change(id)
{ 
	if(id!="00")
	{
     id = document.getElementById(id);      
     if(id.style.display == "") 
          id.style.display = "none"; 
     else 
          id.style.display = ""; 
	}
}
function proses(form){
	var errorm="",trap,polaEmail,matchEmail;
	var name=form.nama.value,email=form.email.value,comment=form.komentar.value,code=form.kode.value;
	name=name.replace(/\s/g,"");
	polaEmail=/^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,3})+$/;
	matchEmail=email.match(polaEmail);
	comment=comment.replace(/\s/g,"");
	if (name==""){errorm=" - Nama Belum Diisi"+"\n";trap="error";}
	if (email==""){errorm=errorm+" - Email Belum Diisi"+"\n";trap="error";}	
	else{ if (matchEmail==null){errorm=errorm+" - Alamat Email Salah"+"\n";trap="error";}}		
	if (code==""){errorm=errorm+" - Kode Karakter Belum Diisi"+"\n";trap="error";}
	if (comment==""){errorm=errorm+" - Komentar Belum Diisi"+"\n";trap="error";}
	if (trap=="error"){alert(" Mohon diperbaiki dan dikirim ulang:"+"\n"+errorm);return false;}
	else return true;
}
function bukawindow(addr,w,h)
{
	window.open(addr,"_blank","toolbar=no, location=no, directories=no, status=no, menubar=no, scrollbars=no, resizable=no, width="+w+", height="+h+"");
}


//AJAX

function loadXMLDoc(url)
{
if (window.XMLHttpRequest)
{// code for IE7+, Firefox, Chrome, Opera, Safari
xmlhttp=new XMLHttpRequest();
}
else
{// code for IE6, IE5
xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
}
xmlhttp.onreadystatechange=state_Change
xmlhttp.open("GET",url,true);
xmlhttp.send(null);
function state_Change()
{
	if(xmlhttp.readyState==4)
  	{document.getElementById('konten').innerHTML=xmlhttp.responseText;}
}
}

	function getPsiData(tipe, no, all) {
		if (all) document.write('<h3 align="center">Informasi-informasi Pusat Sistem Informasi STMIK-STIE Mikroskil</h3><br/>')
     		$(document).ready(function(){
			$.ajax({
				type: "GET",
				url: "jquery/data.xml",
				dataType: "xml",
				success: function(xml) {
					$(xml).find('item').each(function(){
						var type = $(this).attr('type');		
						var id = $(this).attr('id');
						if ( (id == no && type == tipe ) || all) 
						{
							var title = $(this).find('title').text();
							var desc = $(this).find('description').text();
							$('<div class="items" id="link_'+id+'"></div>').html('<p id="subjudul" >'+title+'</p>').appendTo('#page-wrap');
							$('<div class="isi"><div id="teks"></div></div>').html(desc).appendTo('#link_'+id);
						}
					});
				}
			});
		});
		
	}

