﻿// Login --------------------------------------------------------------------------------
function ValidateUser()
    {
        var user = document.getElementById("txtUserid");
        var pass = document.getElementById("txtPassword");
        
        if((user.value == null) || (user.value == ""))
        {
            alert("E-mail Id Should not be Empty");
            user.focus();
            return false;
        }
        if (echeck(user.value)==false)
        {
		    user.value="";
		    user.focus();
		    return false;
	    }
        if((pass.value == null) || (pass.value == ""))
        {
            alert("Password Should not be Empty");
            pass.focus();
            return false;
        }
        return true;
    }
    
    function echeck(str)
    {
		var at="@";
		var dot=".";
		var lat=str.indexOf(at);
		var lstr=str.length;
		var ldot=str.indexOf(dot);
		if (str.indexOf(at)==-1)
		{
		   alert("Invalid E-mail ID");
		   return false;
		}

		if (str.indexOf(at)==-1 || str.indexOf(at)==0 || str.indexOf(at)==lstr)
		{
		   alert("Invalid E-mail ID");
		   return false;
		}

		if (str.indexOf(dot)==-1 || str.indexOf(dot)==0 || str.indexOf(dot)==lstr)
		{
		    alert("Invalid E-mail ID");
		    return false;
		}

		 if (str.indexOf(at,(lat+1))!=-1)
		 {
		    alert("Invalid E-mail ID");
		    return false
		 }

		 if (str.substring(lat-1,lat)==dot || str.substring(lat+1,lat+2)==dot){
		    alert("Invalid E-mail ID")
		    return false;
		 }

		 if (str.indexOf(dot,(lat+2))==-1)
		 {
		    alert("Invalid E-mail ID");
		    return false;
		 }
		
		 if (str.indexOf(" ")!=-1)
		 {
		    alert("Invalid E-mail ID");
		    return false;
		 }
 		 return true;	
	}

// Current Time ------------------------------------------------------------------------
function MakeArrayday(size) {
    this.length = size;
    for(var i = 1; i <= size; i++) {
    this[i] = "";
    }
    return this;
}

function MakeArraymonth(size) {
    this.length = size;
    for(var i = 1; i <= size; i++) {
    this[i] = "";
}
    return this;
}

function funClock() {
    if (!document.layers && !document.all)
        return;
        var runTime = new Date();
        var hours = runTime.getHours();
        var minutes = runTime.getMinutes();
        var seconds = runTime.getSeconds();
        var dn = "AM";
    if (hours >= 12) {
        dn = "PM";
        hours = hours - 12;
    }
        if (hours == 0) {
        hours = 12;
    }
    if (minutes <= 9) {
        minutes = "0" + minutes;
    }
    if (seconds <= 9) {
        seconds = "0" + seconds;
    }
        movingtime = hours + ":" + minutes + ":" + seconds + " " + dn ;
    if (document.layers) {
        document.layers.clock.document.write(movingtime);
        document.layers.clock.document.close();
    }
    else if (document.all) {
        clock.innerHTML = movingtime;
    }
        setTimeout("funClock()", 1000)
    }
        window.onload = funClock;
        
   // rotate image -----------------------------------------------------------
    var slideimages=new Array()
    function slideshowimages(){
      for (i=0;i<slideshowimages.arguments.length;i++){
      slideimages[i]=new Image()
      slideimages[i].src=slideshowimages.arguments[i]
      }
    }
    

