function validateForm(thisform,varUrl){
    if(thisform.name.value.length==0 && thisform.name.value==""){
        alert("Silakan Isi Nama Anda");
        thisform.name.focus();
    }else if(thisform.email.value.length==0 && thisform.email.value==""){
        alert("Silakan Isi Email Anda");
        thisform.email.focus();
    }else if(thisform.publicinfo.value.length==0 ){
        alert("Silakan Isi Info Anda");
        thisform.publicinfo.focus();
    }else if(thisform.security_code.value.length==0 && thisform.security_code.value==""){
        alert("Silakan Isi Kode");
        thisform.security_code.focus();
    }else{
        var params="";
        for(i=0; i<thisform.elements.length; i++){
            if(thisform.elements[i].type=='text' || thisform.elements[i].type=='textarea' || thisform.elements[i].type=='hidden'){
                if(params==""){
                    params=thisform.elements[i].name+'='+thisform.elements[i].value;
                }else{
                    params=params+'&'+thisform.elements[i].name+'='+thisform.elements[i].value;
                }
            }
            
        }
        
        var xmlHttp;
        try{  // Firefox, Opera 8.0+, Safari  
            xmlHttp=new XMLHttpRequest();  
        }
        catch (e){  // Internet Explorer  
            try{    
                xmlHttp=new ActiveXObject("Msxml2.XMLHTTP");    
            }
            catch (e){    
                try{      
                    xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");      
                }
                catch (e){      
                    alert("Your browser does not support AJAX!");      
                    return false;      
                }    
            }  
        }
        var url = varUrl;
        xmlHttp.open("POST", url, true);
        xmlHttp.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
        xmlHttp.setRequestHeader("Content-length", params.length);
        xmlHttp.setRequestHeader("Connection", "close");
        
        xmlHttp.onreadystatechange = function() {
            if(xmlHttp.readyState == 4 && xmlHttp.status == 200) {
                //alert (url + ' ' + xmlHttp.responseText);
                tmp=xmlHttp.responseText.split('~');
                if(tmp[0]==0){
                    alert("Info anda gagal di simpan");
                    document.getElementById('captcha').innerHTML=tmp[1];
				} else if(tmp[0]==2){
                    thisform.security_code.value= "";
					thisform.security_code.focus();
					alert("Kode salah, silakan coba lagi!");
                    document.getElementById('captcha').innerHTML=tmp[1];					
                }else{
                    alert("Terima kasih. Info Anda akan segera kami proses");
                    document.getElementById('captcha').innerHTML=tmp[1];
                    thisform.reset();
                }
            }
        }
        xmlHttp.send(params);
    }
}

function validateQuestionForm(thisform,varUrl){
    if(thisform.name.value.length==0 && thisform.name.value==""){
        alert("Silakan Isi Nama Anda");
        thisform.name.focus();
    }else if(thisform.email.value.length==0 && thisform.email.value==""){
        alert("Silakan Isi Email Anda");
        thisform.email.focus();
    }else if(thisform.question.value.length==0 ){
        alert("Silakan Isi Pertanyaan Anda");
        thisform.question.focus();
    }else if(thisform.security_code.value.length==0 && thisform.security_code.value==""){
        alert("Silakan Isi Kode");
        thisform.security_code.focus();
    }else{
        var params="";
        for(i=0; i<thisform.elements.length; i++){
            if(thisform.elements[i].type=='text' || thisform.elements[i].type=='textarea' || thisform.elements[i].type=='hidden'){
                if(params==""){
                    params=thisform.elements[i].name+'='+thisform.elements[i].value;
                }else{
                    params=params+'&'+thisform.elements[i].name+'='+thisform.elements[i].value;
                }
            }
            
        }
        
        var xmlHttp;
        try{  // Firefox, Opera 8.0+, Safari  
            xmlHttp=new XMLHttpRequest();  
        }
        catch (e){  // Internet Explorer  
            try{    
                xmlHttp=new ActiveXObject("Msxml2.XMLHTTP");    
            }
            catch (e){    
                try{      
                    xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");      
                }
                catch (e){      
                    alert("Your browser does not support AJAX!");      
                    return false;      
                }    
            }  
        }
        var url = varUrl;
        xmlHttp.open("POST", url, true);
        xmlHttp.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
        xmlHttp.setRequestHeader("Content-length", params.length);
        xmlHttp.setRequestHeader("Connection", "close");
        
        xmlHttp.onreadystatechange = function() {
            if(xmlHttp.readyState == 4 && xmlHttp.status == 200) {
                //alert (url + ' ' + xmlHttp.responseText);
                tmp=xmlHttp.responseText.split('~');
                if(tmp[0]==0){
                    alert("Info anda gagal di simpan");
                    document.getElementById('captcha').innerHTML=tmp[1];
				} else if(tmp[0]==2){
                    thisform.security_code.value= "";
					thisform.security_code.focus();
					alert("Kode salah, silakan coba lagi!");
                    document.getElementById('captcha').innerHTML=tmp[1];					
                }else{
                    alert("Terima kasih. Pertanyaan Anda akan segera kami proses");
                    document.getElementById('captcha').innerHTML=tmp[1];
                    thisform.reset();
                }
            }
        }
        xmlHttp.send(params);
    }
}

function validateCommentForm(thisform,varUrl){
    if(thisform.name.value.length==0 && thisform.name.value==""){
        alert("Silakan Isi Nama Anda");
        thisform.name.focus();
    }else if(thisform.email.value.length==0 && thisform.email.value==""){
        alert("Silakan Isi Email Anda");
        thisform.email.focus();
    }else if(thisform.comments.value.length==0 ){
        alert("Silakan Isi Komentar Anda");
        thisform.question.focus();
    }else if(thisform.security_code.value.length==0 && thisform.security_code.value==""){
        alert("Silakan Isi Kode");
        thisform.security_code.focus();
    }else{
        var params="";
        for(i=0; i<thisform.elements.length; i++){
            if(thisform.elements[i].type=='text' || thisform.elements[i].type=='textarea' || thisform.elements[i].type=='hidden'){
                if(params==""){
                    params=thisform.elements[i].name+'='+thisform.elements[i].value;
                }else{
                    params=params+'&'+thisform.elements[i].name+'='+thisform.elements[i].value;
                }
            }
            
        }
        
        var xmlHttp;
        try{  // Firefox, Opera 8.0+, Safari  
            xmlHttp=new XMLHttpRequest();  
        }
        catch (e){  // Internet Explorer  
            try{    
                xmlHttp=new ActiveXObject("Msxml2.XMLHTTP");    
            }
            catch (e){    
                try{      
                    xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");      
                }
                catch (e){      
                    alert("Your browser does not support AJAX!");      
                    return false;      
                }    
            }  
        }
        var url = varUrl;
        xmlHttp.open("POST", url, true);
        xmlHttp.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
        xmlHttp.setRequestHeader("Content-length", params.length);
        xmlHttp.setRequestHeader("Connection", "close");
        
        xmlHttp.onreadystatechange = function() {
            if(xmlHttp.readyState == 4 && xmlHttp.status == 200) {
                //alert (url + ' ' + xmlHttp.responseText);
                tmp=xmlHttp.responseText.split('~');
                if(tmp[0]==0){
                    alert("Komentar anda gagal di simpan");
                    document.getElementById('captcha').innerHTML=tmp[1];
				} else if(tmp[0]==2){
                    thisform.security_code.value= "";
					thisform.security_code.focus();
					alert("Kode salah, silakan coba lagi!");
                    document.getElementById('captcha').innerHTML=tmp[1];					
                }else{
                    alert("Terima kasih. Komentar Anda akan segera kami proses");
                    document.getElementById('captcha').innerHTML=tmp[1];
                    thisform.reset();
                }
            }
        }
        xmlHttp.send(params);
    }
}

function LimitChar(thisobj) {
	//var thisobj=event.srcElement;
	if (thisobj.value.length==thisobj.maxLength*1) return false;
}

function CountChar(thisobj,txtobj) {
	//var thisobj=event.srcElement;
	if (thisobj.value.length>thisobj.maxLength) 
		thisobj.value=thisobj.value.substring(0,thisobj.maxLength);
	if (txtobj) txtobj.value=500-thisobj.value.length;
}

function article_fontSizer(size) {
var article_body = document.getElementById('article_body');
 if (size == "small"){article_body.style.fontSize = "12px";}
 if (size == "medium"){article_body.style.fontSize ="14px";}
 if (size == "large"){article_body.style.fontSize ="16px";}
}
