function randomquote(quotelist, tagid, speed, quotesname) {
  	this.slideList = quotelist;
  	this.quotesname = quotesname;
  	this.speed = speed;
  	this.tagid = tagid;
  	this.current = this.slideList.length-1;
	this.timer = 0;
}
randomquote.prototype.play = quotes_play;
randomquote.prototype.stops = quotes_stops;
randomquote.prototype.next = quotes_next;
randomquote.prototype.prev = quotes_prev;
function quotes_next() {
  	with(this) {
		clearTimeout(timer);
		if(current++ == slideList.length-1) current = 0;
		if(document.getElementById) {
			var legend = document.getElementById(tagid);
		} else {
			var legend = document.all.tagid;
		}	
		if(slideList[current] != "undefined" || slideList[current] != "" || slideList[current] != "none") {
			legend.innerHTML = slideList[current];
		}
		timer = setTimeout(quotesname+'.play()', speed);
	}
}
function quotes_prev() {
  	with(this) {
		clearTimeout(timer);
		if(current-- == 0) current = slideList.length-1;
		if(document.getElementById) {
			var legend = document.getElementById(tagid);
		} else {
			var legend = document.all.tagid;
		}	
		if(slideList[current] != "undefined" || slideList[current] != "" || slideList[current] != "none") {
			legend.innerHTML = slideList[current];
		}
		timer = setTimeout(quotesname+'.play()', speed);
	}
}
function quotes_stops() {
  	with(this) {
		if(timer != 0) {
			clearTimeout(timer);
			timer = 0;
		}
	}
}
function quotes_play() {
  	with(this) {
		if(current++ == slideList.length-1) current = 0;
		if(document.getElementById) {
			var legend = document.getElementById(tagid);
		} else {
			var legend = document.all.tagid;
		}	
		if(slideList[current] != "undefined" || slideList[current] != "" || slideList[current] != "none") {
			
			legend.innerHTML = slideList[current];
		}
		clearTimeout(timer);
		timer = setTimeout(quotesname+'.play()', speed);
	}
}
function popup(url, lebar, tinggi) 
{
	lebars = screen.width;
	tinggis = screen.height;
	poskiri = (lebars - lebar) / 2;
	posatas = (tinggis - tinggi) / 2;
	params = 'directories=no';
	params += ', location=yes';
	params += ', menubar=no';
	params += ', status=no';
	params += ', toolbar=no';
	params += ', width='+lebar;		
	params += ', height='+tinggi;		
	params += ', top='+posatas;
	params += ', left='+poskiri;
	params += ', resizable=no';
	params += ', scrollbars=yes';
	params += ', alwaysRaised=yes';

	newwin=window.open(url,'popupwin', params);
	if (window.focus) {newwin.focus()}
	return false;
}
function konfirm() {
	if (!confirm("Apakah Anda yakin ingin menghapus data ini?")) {
		return false;
	}
}
function toggle(e) {
	var agt = navigator.userAgent.toLowerCase();
	var is_ie = ((agt.indexOf("msie") != -1) && (agt.indexOf("opera") == -1));
	var is_mac = (agt.indexOf("mac") != -1);
	if(!(is_ie && is_mac) && document.getElementById) {
		var legend = document.getElementById(e);
	} else {
		var legend = document.all.e;
	}
	if (legend.style.display == "none") { legend.style.display = "block"; } else { legend.style.display = "none"; }
}
function MM_reloadPage(init) {  //reloads the window if Nav4 resized
  if (init==true) with (navigator) {if ((appName=="Netscape")&&(parseInt(appVersion)==4)) {
    document.MM_pgW=innerWidth; document.MM_pgH=innerHeight; onresize=MM_reloadPage; }}
  else if (innerWidth!=document.MM_pgW || innerHeight!=document.MM_pgH) location.reload();
}
MM_reloadPage(true);
function MM_jumpMenu(selObj,restore){ //v3.0
  eval(loadurl(selObj.options[selObj.selectedIndex].value));
  if(restore) selObj.selectedIndex=0;
}
function MM_findObj(n, d) { //v4.01
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
  if(!x && d.getElementById) x=d.getElementById(n); return x;
}
function MM_jumpMenuGo(selName,restore){ //v3.0
  var selObj = MM_findObj(selName); if (selObj) MM_jumpMenu(selObj,restore);
}
function dynamicSelect(id1, id2) {
	var agt = navigator.userAgent.toLowerCase();
	var is_ie = ((agt.indexOf("msie") != -1) && (agt.indexOf("opera") == -1));
	var is_mac = (agt.indexOf("mac") != -1);
	if (!(is_ie && is_mac) && document.getElementById && document.getElementsByTagName) {
		var sel1 = document.getElementById(id1);
		var sel2 = document.getElementById(id2);
		var clone = sel2.cloneNode(true);
		var clonedOptions = clone.getElementsByTagName("option");
		refreshDynamicSelectOptions(sel1, sel2, clonedOptions);
		sel1.onchange = function() {
			refreshDynamicSelectOptions(sel1, sel2, clonedOptions);
		};
	}
}
function refreshDynamicSelectOptions(sel1, sel2, clonedOptions) {
	while (sel2.options.length) {
		sel2.remove(0);
	}
	var pattern1 = /( |^)(select)( |$)/;
	var pattern2 = new RegExp("( |^)(" + sel1.options[sel1.selectedIndex].value + ")( |$)");
	for (var i = 0; i < clonedOptions.length; i++) {
		if (clonedOptions[i].className.match(pattern1) || clonedOptions[i].className.match(pattern2)) {
			sel2.appendChild(clonedOptions[i].cloneNode(true));
		}
	}
}
function addformfile() {
	var agt = navigator.userAgent.toLowerCase();
	var is_ie = ((agt.indexOf("msie") != -1) && (agt.indexOf("opera") == -1));
	var is_mac = (agt.indexOf("mac") != -1);
	if (!(is_ie && is_mac) && document.getElementById && document.getElementsByTagName) {
		var a=document.getElementsByTagName("form");
		var i=document.createElement("input");
		i.setAttribute("type","file");
		i.setAttribute("name","imgfile[]");
		var b=document.createElement("br");
		a[0].appendChild(i);
		a[0].appendChild(b);
	}
}
function validate_required(field,alerttxt) {
	with (field) {
		if(value==null||value=="") { alert(alerttxt); return false; } else { return true; }
	}
}

function validate_email(field,alerttxt) {
	with (field) {
		apos=value.indexOf("@");
		dotpos=value.lastIndexOf(".");
		if(apos<1||dotpos-apos<2){ alert(alerttxt); return false; } else { return true; }
	}
}
function validate_nl(thisform) {
	with (thisform) {
		if(validate_required(name,"Name field must be filled out!")==false) { name.focus(); return false; }
		if(validate_email(email,"Please enter valid e-mail address!")==false) { email.focus(); return false; }
		alert('Message sent and being proccessed on server'); window.close();
	}	
}
function validate_consultation(thisform) {
	with (thisform) {
		if(validate_required(name,"Name field must be filled out!")==false) { name.focus(); return false; }
		if(validate_email(email,"Please enter valid e-mail address!")==false) { email.focus(); return false; }
		if(validate_required(message,"Message field must be filled out!")==false) { message.focus(); return false; }
		alert('Message sent and being proccessed on server'); window.close();
	}
}
function validate_quotation(thisform) {
	with (thisform) {
		if(validate_required(name,"Name field must be filled out!")==false) { name.focus(); return false; }
		if(validate_required(address,"Adress field must be filled out!")==false) { address.focus(); return false; }
		if(validate_required(contact,"Contact field must be filled out!")==false) { contact.focus(); return false; }
		if(validate_email(email,"Please enter valid e-mail address!")==false) { email.focus(); return false; }
		alert('Message sent and being proccessed on server'); window.close();
	}
}
function recentcss(tagid,color) {
	var agt = navigator.userAgent.toLowerCase();
	var is_ie = ((agt.indexOf("msie") != -1) && (agt.indexOf("opera") == -1));
	var is_mac = (agt.indexOf("mac") != -1);
	if(!(is_ie && is_mac) && document.getElementById) {
		var recent = document.getElementById(tagid);
	} else {
		var recent = document.all.tagid;
	}
	recent.style.color = color;
}
var scrollInterval = null;
var scrollInterval2 = null;
function startScroll(direction, interval) {
	if(direction == "up") { y = -5 - interval } else { y = 5 + interval }
	document.getElementById("artikelspacer").scrollTop += y;
	newInterval = interval + 1;
	var functionCall = "startScroll(\"" + direction + "\", " + newInterval + ")";
	scrollInterval = setTimeout(functionCall, 50);
	return false;
}
function endScroll() {
	if(scrollInterval != null) { clearInterval(scrollInterval); }
	return false;
}
function startScroll2(direction, interval) {
	if(direction == "up") { y = -5 - interval } else { y = 5 + interval }
	document.getElementById("isifaq").scrollTop += y;
	newInterval = interval + 1;
	var functionCall = "startScroll2(\"" + direction + "\", " + newInterval + ")";
	scrollInterval2 = setTimeout(functionCall, 50);
	return false;
}
function endScroll2() {
	if(scrollInterval2 != null) { clearInterval(scrollInterval2); }
	return false;
}