//basic validation
function cekEmail(x){
        if ((x.indexOf('@')==-1)||(x.indexOf('.')==-1)||(x.indexOf(' ')!=-1)||(x.length<5)){
                return false;
        }
        return;
}
function validMe() {

        if (document.theFrom.username.value.length==0){
                alert("You failed to correctly fill in your : Username");
                document.theFrom.username.focus();
                return false;
        }       
		else if (document.theFrom.password.value.length==0){
                alert("You failed to correctly fill in your : Password");
                document.theFrom.password.focus();
                return false;
        }      
							
		return true;
}

function validForgot() {

        if (cekEmail(document.theFrom.email.value)==false){
                alert("You failed to correctly fill in your : E-mail OR isn't valid E-mail address");
               document.theFrom.email.focus();
               return false;
        }		
							
		return true;
}

function validSearch() {

        if (document.theFrom.search.value.length==0){
                alert("You failed to correctly fill in your : Search field");
                document.theFrom.search.focus();
                return false;
        }
		
		return true;
}


//img faddding
opacity=0 //opacity of image
var increase=1 //increase opacity indicator
var decrease=0 //decrease opacity indicator

function fade(){
if (opacity<0.6&&increase)
opacity+=0.05
else{
increase=0
decrease=1
}

if (opacity>0.3&&decrease)
opacity-=0.05
else{
increase=1
decrease=0
}

document.getElementById("test").style.MozOpacity=opacity
}

if (document.getElementById("test") && document.getElementById("test").style.MozOpacity) //if Firefox/ NS6+
setInterval("fade()",100)



/**
 * DHTML check all/clear all links script. Courtesy of SmartWebby.com (http://www.smartwebby.com/dhtml/)
 */
function CheckAll(myform) {
		for (var i=0;i<myform.elements.length;i++)
		{201
			var e = myform.elements[i];
			if ((e.name != 'SELECTALL') && (e.type=='checkbox'))
			e.checked = myform.SELECTALL.checked;
		}	
	}	

function Periksa(form) {
	if (confirm("Are you sure want to delete data?")){
		form.submit();
		return true;
	}	
	
}

function popUp(URL) {
day = new Date();
id = day.getTime();
eval("page" + id + " = window.open(URL, '" + id + "', 'toolbar=0,scrollbars=0,location=0,statusbar=0,menubar=0,resizable=0,width=500,height=500,left = 390,top = 262');");
}

// 
var message="";
///////////////////////////////////
function clickIE() {if (document.all) {(message);return false;}}
function clickNS(e) {if 
(document.layers||(document.getElementById&&!document.all)) {
if (e.which==2||e.which==3) {(message);return false;}}}
if (document.layers) 
{document.captureEvents(Event.MOUSEDOWN);document.onmousedown=clickNS;}
else{document.onmouseup=clickNS;document.oncontextmenu=clickIE;}

document.oncontextmenu=new Function("return false")
// --> 


// Copyright 1999 - 2002 by Ray Stott - ver 2.0
// OK to use on noncommercial sites as long as copyright is included
// Commercial Sites, please see http://www.crays.com/jsc/jsCom.htm 
// Script is available at http://www.crays.com/jsc          

var popWin = null    // use this when referring to pop-up window
var winCount = 0
var winName = "popWin"
function openPopWin(winURL, winWidth, winHeight, winFeatures, winLeft, winTop){
  var d_winLeft = 20  // default, pixels from screen left to window left
  var d_winTop = 20   // default, pixels from screen top to window top
  winName = "popWin" + winCount++ //unique name for each pop-up window
  closePopWin()           // close any previously opened pop-up window
  if (openPopWin.arguments.length >= 4)  // any additional features? 
    winFeatures = "," + winFeatures
  else 
    winFeatures = "" 
  if (openPopWin.arguments.length == 6)  // location specified
    winFeatures += getLocation(winWidth, winHeight, winLeft, winTop)
  else
    winFeatures += getLocation(winWidth, winHeight, d_winLeft, d_winTop)
  popWin = window.open(winURL, winName, "width=" + winWidth 
           + ",height=" + winHeight + winFeatures)
  }
function closePopWin(){    // close pop-up window if it is open 
  if (navigator.appName != "Microsoft Internet Explorer" 
      || parseInt(navigator.appVersion) >=4) //do not close if early IE
    if(popWin != null) if(!popWin.closed) popWin.close() 
  }
function getLocation(winWidth, winHeight, winLeft, winTop){
  return ""
  }
//-->

<!--
function getLocation(winWidth, winHeight, winLeft, winTop){
  var winLocation = ""
  if (winLeft < 0)
    winLeft = screen.width - winWidth + winLeft
  if (winTop < 0)
    winTop = screen.height - winHeight + winTop
  if (winTop == "cen")
    winTop = (screen.height - winHeight)/2 - 20
  if (winLeft == "cen")
    winLeft = (screen.width - winWidth)/2
  if (winLeft>0 & winTop>0)
    winLocation =  ",screenX=" + winLeft + ",left=" + winLeft	
                + ",screenY=" + winTop + ",top=" + winTop
  else
    winLocation = ""
  return winLocation
  }
//-->

// Dynamic Version by: Nannette Thacker -->
// http://www.shiningstar.net -->

function textCounter(field,cntfield,maxlimit) {
if (field.value.length > maxlimit) // if too long...trim it!
field.value = field.value.substring(0, maxlimit);
// otherwise, update 'characters left' counter
else
cntfield.value = maxlimit - field.value.length;
}
//  End -->

