// By Setiyo G. (16/7/2004)
// Validate email entry
function checkemail(email) {
    if (email.length < 11 || email.indexOf("@")==-1 || email.indexOf(".")==-1 || email.indexOf("!")!=-1 || email.indexOf("..")!=-1 || email.indexOf(".")==0 || email.indexOf(".")==email.length|| email.indexOf("neowed")!=-1 || email.indexOf("menaravisi")!=-1 || email.indexOf("weddingku")!=-1 || email.indexOf("test")!=-1 || email.indexOf("hjkl")!=-1 || email.indexOf("yuio")!=-1 || email.indexOf("zxcv")!=-1 || email.indexOf("asdf")!=-1 || email.indexOf("qwer")!=-1)
		return false;
    else {
		var pos;
		pos = email.indexOf("@");
		var mailbox=email.substring(0,pos);
		var domainname=email.substring(pos+1,email.length);
		var mailboxlast=mailbox.substring(mailbox.length-1,mailbox.length);
		var domainfirst=domainname.substring(0,1);
		var lastdigit=email.substring(email.length-1,email.length);
		var firstdigit=email.substring(0,1)
		if (mailbox.indexOf("-")==-1 && domainname.indexOf("_")==-1 && domainname.indexOf("@")==-1 && lastdigit.indexOf(".")==-1 && lastdigit.indexOf("-")==-1 && firstdigit.indexOf(".")==-1 && firstdigit.indexOf("_")==-1 && mailboxlast.indexOf(".")==-1 && mailboxlast.indexOf("_")==-1 && domainfirst.indexOf(".")==-1 && domainfirst.indexOf("-")==-1)
			return true;
		else
			return false;
    }
}


//add trim function to String object
String.prototype.trim = function()
{
  return( this.replace(/^\s*([\s\S]*\S+)\s*$|^\s*$/,'$1') );   
}

// By Setiyo G. (1/12/2005)
// Validate Script/HTML Tags
function checktags(chkstr) {
		if (chkstr.indexOf("i>")==-1 && chkstr.indexOf("b>")==-1 && chkstr.indexOf("p>")==-1 && chkstr.indexOf("h1>")==-1 && chkstr.indexOf("h2>")==-1 && chkstr.indexOf("h3>")==-1 && chkstr.indexOf("h4>")==-1 && chkstr.indexOf("h5>")==-1 && chkstr.indexOf("h6>")==-1 && chkstr.indexOf("body>")==-1 && chkstr.indexOf("html>")==-1 && chkstr.indexOf("br>")==-1 && chkstr.indexOf("hr>")==-1 && chkstr.indexOf("font>")==-1 && chkstr.indexOf("'")==-1 && chkstr.indexOf("script>")==-1 && chkstr.indexOf("-->>")==-1 && chkstr.indexOf("<!--")==-1 && chkstr.indexOf("form>")==-1 && chkstr.indexOf("div>")==-1 && chkstr.indexOf("u>")==-1 && chkstr.indexOf("ol>")==-1 && chkstr.indexOf("ul>")==-1 && chkstr.indexOf("select>")==-1 && chkstr.indexOf("<input")==-1 && chkstr.indexOf("location.href")==-1 && chkstr.indexOf("response.redirect")==-1 && chkstr.indexOf("<%")==-1 && chkstr.indexOf("%>")==-1)
		{
			return true;
		}
		else
		{
			return false;
		}

}


function checkname(name) {
    if (name.indexOf("wedsite")!=-1 || name.indexOf("website")!=-1 || name.indexOf(".info")!=-1 || name.indexOf(".biz")!=-1 || name.indexOf(".or")!=-1 || name.indexOf(".net")!=-1 || name.indexOf(".co")!=-1 || name.indexOf("www")!=-1 || name.indexOf("@")!=-1 || name.indexOf("neowed")!=-1 || name.indexOf("menaravisi")!=-1 || name.indexOf("weddingku")!=-1 || name.indexOf("test")!=-1 || name.indexOf("hjkl")!=-1 || name.indexOf("yuio")!=-1 || name.indexOf("zxcv")!=-1 || name.indexOf("asdf")!=-1 || name.indexOf("qwer")!=-1)
		return false;
	else
		return true;
}

// By Hengky I. (5/6/2004)
// validate Time format
function checkdate(intDay,intMonth,intYear) {
	var dtDate = new Date(intMonth + '/' + intDay + '/' + intYear )
    if (dtDate.getDate() != intDay && dtDate.getMonth() != intMonth-1) 
    	return false;
    else
    	return true;
}
