function MM_swapImgRestore() { //v3.0
  var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}

function MM_preloadImages() { //v3.0
  var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
    var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
    if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}

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_swapImage() { //v3.0
  var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
   if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}
function Check_Char(id_text)
{
	var alpha = 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ';
	var numeric = '1234567890';
	var nonkorean = alpha+numeric;		
	var i ; 
	for ( i=0; i < id_text.length; i++ )  {
		if( nonkorean.indexOf(id_text.substring(i,i+1)) < 0) {
			break ; 
		}
	}
	if ( i != id_text.length ) {
		return false ;
	}
	else{
		return true ;
	}
	return true;
}
function chkfrmlog(theForm) {
   	if (theForm.username.value == "") {
   		alert("INPUT YOUR ID YOU WISH");
   		theForm.username.focus();
   		return false;
   	}
   	if (theForm.password.value == "") {
   		alert("INPUT YOUR PASSWORD YOU WISH");
   		theForm.password.focus();
   		return false;
   	}
	return true;
}
function search_partall(frm)
{							
	if(frm.PartNo.value=="")
	{
		alert("Please input a part number");
		frm.PartNo.focus();
		return false;
	}
	if (frm.PartNo.value.length)
	{
		if (frm.PartNo.value.length < 3)
		{
			alert('Part Number must be 3 characters long');
			frm.PartNo.focus();
			frm.PartNo.select();
		return false;
		}
	}
}
function check_Email() {
	var email = document.regform.email.value;
	var email_1 = "";
	var email_2 = "";
	var check_point = 0;

	if (email.indexOf("@") < 0 ) {
		alert("INCORRECT E-MAIL ADDRESS \nPLEASE INPUT CORRECT EMAIL ADDRESS");
		document.regform.email.focus();
		return false;
	}
	if (email.indexOf(".") < 0 ) {
		alert("INCORRECT E-MAIL ADDRESS \nPLEASE INPUT CORRECT EMAIL ADDRESS");
		document.regform.email.focus();
		return false;
	}
	if (email.indexOf("|") >= 0 ) {
		alert("E-MAIL ADDRESS MUST NOT INCLUDE '|'");
		document.regform.email.focus();
		return false;
	}
	if (email.indexOf(">") >= 0 ) {
		alert("E-MAIL ADDRESS MUST NOT INCLUDE '>'");
		document.regform.email.focus();
		return false;
	}
	if (email.indexOf("<") >= 0 ) {
		alert("E-MAIL ADDRESS MUST NOT INCLUDE '<'");
		document.regform.email.focus();
		return false;
	}
	if (email.indexOf(" ") >= 0 ) {
		alert("E-MAIL ADDRESS MUST NOT INCLUDE SPACE");
		document.regform.email.focus();
		return false;
	}
	for (var j = 0 ; j < email.length; j++) {
		if ( email.substring(j, j + 1) != "@"  && check_point == 0 ) {
			email_1 = email_1 + email.substring(j, j + 1)
        } else if ( email.substring(j, j + 1) == "@" ) {
			check_point = check_point + 1;
        } else {
          	email_2 = email_2 + email.substring(j, j + 1);
        }
    }
	if (email_1.length < 2 ) {
		alert("YOU MUST INPUT AT LEAST 2 CHARACTERS LONG BEFORE '@'");
		document.regform.email.focus();
		return false;
	}
	if (email_2.length < 2 ) {
		alert("YOU MUST INPUT AT LEAST 2 CHARACTERS LONG AFTER '@'");
		document.regform.email.focus();
		return false;
	}
	if (check_point > 1 ) {
		alert("YOU CANNOT INPUT '@' MORE THAN ONCE");
		document.regform.email.focus();
		return false;
	}
	if (email_2.indexOf("(") >= 0 ) {
		alert("E-MAIL ADDRESS MUST NOT INCLUDE '('");
		document.regform.email.focus();
		return false;
	}
	if (email_2.indexOf(")") >= 0 ) {
		alert("E-MAIL ADDRESS MUST NOT INCLUDE ')'");
		document.regform.email.focus();
		return false;
	}
	if (email_2.indexOf(",") >= 0 ) {
		alert("e-mail¿¡ , ´Â Æ÷ÇÔÇÒ¼ö ¾ø½À´Ï´Ù..");
		document.regform.email.focus();
		return false;
	}
	if (email_2.indexOf(";") >= 0 ) {
		alert("E-MAIL ADDRESS MUST NOT INCLUDE ';'");
		document.regform.email.focus();
		return false;
	}
	if (email_2.indexOf(":") >= 0 ) {
		alert("E-MAIL ADDRESS MUST NOT INCLUDE ':'");
		document.regform.email.focus();
		return false;
	}
	if (email_2.indexOf("/") >= 0 ) {
		alert("E-MAIL ADDRESS MUST NOT INCLUDE '/'");
		document.regform.email.focus();
		return false;
	}
	if (email_2.indexOf("[") >= 0 ) {
		alert("E-MAIL ADDRESS MUST NOT INCLUDE '['");
		document.regform.email.focus();
		return false;
	}
	if (email_2.indexOf("]") >= 0 ) {
		alert("E-MAIL ADDRESS MUST NOT INCLUDE ']'");
		document.regform.email.focus();
		return false;
	}
	if (email_2.indexOf("{") >= 0 ) {
		alert("E-MAIL ADDRESS MUST NOT INCLUDE '{'");
		document.regform.email.focus();
		return false;
	}
	if (email_2.indexOf("}") >= 0 ) {
		alert("E-MAIL ADDRESS MUST NOT INCLUDE '}'");
		document.regform.email.focus();
		return false;
	}
	if (email_2.indexOf(" ") >= 0 ) {
		alert("E-MAIL ADDRESS MUST NOT INCLUDE SPACE");
		document.regform.email.focus();
		return false;
	}
	return true;
}

function CheckRegForm(theForm)
{
	if(theForm.username.value == "")
	{
		alert("Please input a Account");
		theForm.username.focus();
		return false;
	}	
	if (theForm.username.value.length < 2 || theForm.username.value.length > 20 )
	{
		alert("ID MUST BE 2 ~ 20 CHARACTERS");
		theForm.username.focus();
		return false;
	}
    if (theForm.password.value == "")
	{
        alert("INPUT PASSWORD YOU WISH");
		theForm.password.focus();
        return false;
    }
	else
	{ 
		thisfilednum = Check_Char(theForm.password.value);
        if (!thisfilednum)
		{
			alert("INPUT ONLY NUMBER AND ENGLISH MIXED");
			theForm.password.focus();
			theForm.password.select();
			return false;
        }
	}
    if (theForm.password.value.length < 6 ||  theForm.password.value.length > 12 )
	{
	   	alert("PASSWORD MUST BE 6 ~ 12 CHARACTERS");
       	theForm.password.focus();
       	return false;
    }
    if (theForm.repwd.value == "")
	{
		alert("INPUT CONFIRM PASSWORD YOU WISH");
		theForm.repwd.focus();
		return false;
    }
    if (theForm.password.value != theForm.repwd.value)
	{
		alert("PASSWORD AND CONFIRM PASSWORD DOESN'T MATCH EXACTLY \nPLEASE TRY TO INPUT AGAIN");
		theForm.repwd.focus();
		return false;
    }
	if (theForm.email.value == "") {
        alert("INPUT EMAIL ADDRESS YOU WISH");
        theForm.email.focus();
        return false;
    }	
	if (theForm.email.value != "") {
		if ( !check_Email() ) {
			theForm.email.focus();
			return false;
		}
	}
}
function PageR(id){
  document.jump.page.value=id;
  document.jump.submit();
}
function checkFeedForm(theForm)
{
	if(theForm.title.value == "")
	{
		alert("Please Input Title.");
		theForm.title.focus();
		return false;
	}
	if(theForm.description.value == "")
	{
		alert("Please Input Description.");
		theForm.description.focus();
		return false;
	}
	if(theForm.username.value == "")
	{
		alert("Please Input Your name.");
		theForm.username.focus();
		return false;
	}
	if(theForm.email.value == "")
	{
		alert("Please Input Your email.");
		theForm.email.focus();
		return false;
	}
}