


///////////////////////////////////START USER SECTION

 var arrUser= new Array(12);

//USER1
  arrUser[0]="John";
  arrUser[1]="John1";

///USER2   
  arrUser[2]="Haney";
  arrUser[3]="Haney1";

///USER3
  arrUser[4]="David";
  arrUser[5]="David1";

///USER4
  arrUser[6]="user";
  arrUser[7]="pwd";

///USER5
  arrUser[8]="user1";
  arrUser[9]="pwd1";

///USER6
  arrUser[10]="user2";
  arrUser[11]="pwd2";

///////////////////////////////END USER SECTION



//Get Cookies

function getCookie(c_name)
{
	if(document.cookie.length>0)
	{
  	// alert(document.cookie.length) ;
 	c_start=document.cookie.indexOf(c_name + "=");
  		if (c_start!=-1)
   	 {
   	 c_start=c_start + c_name.length+1;
   	 c_end=document.cookie.indexOf(";",c_start);
    	if (c_end==-1) c_end=document.cookie.length;
    	return unescape(document.cookie.substring(c_start,c_end));
    	}
	 }
  
//return ""
}



// Check if valid user than redirect to desired page otherwise index.html

function checkLogin()
{
	var myuser = getCookie('username');
	var mypassword = getCookie("userpassword");

	if(ValidateUser(myuser, mypassword))
			{								
			document.location ="investor/index.html";	
			
			}


}


////////////////////////Validate User

		function ValidateUser(varusername, varpwd)
		{

		for(i=0; i < arrUser.length; i++)
		{

		if(arrUser[i]==varusername)
		{
		if(arrUser[i+1]==varpwd)
		{
		//alert("username and password matched") ;
		return true;
		}
		else
		{
		alert("login failed")
		return false;
		}

		}
		else
		{
		//alert("No user Match");
		}
		}
		}


//Delete Cookies

function RemoveCookies(c_name,value,expiredays)
{

var exdate=new Date();
exdate.setDate(exdate.getDate()+expiredays);

	
document.cookie=c_name+ "=" +escape(value)+
((expiredays==null) ? "" : ";expires="+exdate.toGMTString());

}



