function chkall() {
	chkname()
    chkemail()
    chkphone()
    chktype()
    chkstart()
    chksets()
    chkdate()
    chkdate()
    chklocation()
}

function formreset() {
    x = document.forms.gigform
    x.reset()
    chkall()
}

function validate() {
    if (chkname() == false) {
        alert("Please Input your Name.")
        return false
    }
    
    if (chkemail() == false) {
        alert("Your E-Mail Address is Invalid.")
        return false
    }
    
    if (chkphone() == false) {
        alert("Please Input your Primary Phone Number.")
        return false
    }
    
    if (chktype() == false) {
        alert("Please Input the Type of Gig.")
        return false
    }
    
    if (chkstart() == false) {
        alert("Please Input the Start time of the Gig.")
        return false
    }
   
    if (chksets() == false) {
        alert("Please Input the Number of Sets to be Performed.")
        return false
    }
    
    if (chkdate() == false) {
        alert("Please Input the Date of the Gig.")
        return false
    }
  
    if (chklocation() == false) {
        alert("Please Input the Location of the Gig.")
        return false
    }
    
    return true
}

function chklocation() {
    x = document.gigform
    giglocation = x.location.value
    
    if (giglocation.length == 0) {
        chngimage(document.reqlocation, false)
        return false
    } else {
        chngimage(document.reqlocation, true)
        return true
    }
}

function chkdate() {
    x = document.gigform
    gigdate = x.gigdate.value
    
    if (gigdate.length == 0) {
        chngimage(document.reqdate, false)
        return false
    } else {
        chngimage(document.reqdate, true)
        return true
    }
}

function chkstart() {
    x = document.gigform
    starttime = x.starttime.value
    
    if (starttime.length == 0) {
        chngimage(document.reqstart, false)
        return false
    } else {
        chngimage(document.reqstart, true)
        return true
    }
}

function chksets() {
    x = document.gigform
    numsets = x.sets.value
    
    if (numsets.length == 0) {
        chngimage(document.reqsets, false)
        return false
    } else {
        chngimage(document.reqsets, true)
        return true
    }
}

function chktype() {
    x = document.gigform
    gigtype = x.type.value
    
    if (gigtype.length == 0) {
        chngimage(document.reqtype, false)
        return false
    } else {
        chngimage(document.reqtype, true)
        return true
    }
}

function chkphone() {
    x = document.gigform
    phonenum = x.primaryphone.value
    
    if (phonenum.length == 0) {
        chngimage(document.reqphone, false)
        return false
    } else {
        chngimage(document.reqphone, true)
        return true
    }
}

function chkname() {
    x = document.gigform
    theirname = x.fname.value
    
    if (theirname.length != 0) {
        chngimage(document.reqname, true)
        return true
    } else {
        chngimage(document.reqname, false)
        return false
    }
}

function chkemail() {
    x = document.gigform
    at = x.email.value.indexOf("@")
    per = x.email.value.indexOf(".")
    
    if (at == -1 || per == -1) {
        chngimage(document.reqemail, false)
        return false
    } else {
        chngimage(document.reqemail, true)
        return true
    }
}

function chngimage( img, comp ) {
    if (comp) {
        img.src = "../images/complete.gif"
    } else {
        img.src = "../images/required.gif"
    }
}
