function changeStatus(){
  window.status = 'Welcome to ShortLabs | Redeployment June \'03';
}

function getDate(){
  month_array = new Array(12);
  month_array [0] = "January";
  month_array [1] = "February";
  month_array [2] = "March";
  month_array [3] = "April";
  month_array [4] = "May";
  month_array [5] = "June";
  month_array [6] = "July";
  month_array [7] = "August";
  month_array [8] = "September";
  month_array [9] = "October";
  month_array [10] = "November";
  month_array [11] = "December";
  var today = new Date();
  var month = today.getMonth();
  var day = today.getDate();
  var year = today.getFullYear();
  var s = "/";
  return month_array[month] + " " + day + " " + year;
}

function openRequirements(){
  //window.open('./require.html','ShortLabs >> Requirements','550,'550');
  s = "width="+550+",height="+550;
  //window.open("./require.html");
  openFrameless("./body.html");
  
}

//**************************************************
//Created by Albert Azout

var windowW=550
var windowH=550

// set the screen position where the popup should appear
// Centralized

var windowX = (screen.width/2)-(windowW/2);
var windowY = (screen.height/2)-(windowH/2);

// set the url of the page to show in the popup
//var urlPop = "./main.html"

// set the title of the page
var title =  "ShortLabs >> Home"

// set this to true if the popup should close
// upon leaving the launching page; else, false
var autoclose = true

// ============================
// do not edit below this line
// ============================

s = "width="+windowW+",height="+windowH;
var beIE = document.all?true:false

var isOpen = false;

//***************************************************
// Image Array - @albert azout
//***************************************************
var img_size = 6; //Number of image options
var offset = 4; //Number of images from document
var img_array=new Array(6);
var isClicked = 7; //Current option selected (7 means none)
var beenClicked = false; //Has anything been clicked

for (i=0; i <6; i++)
img_array[i]=new Array(6);

img_array[0][0]="black_intro.gif";
img_array[0][1]="gray_intro.gif";
img_array[1][0]="black_core.gif";
img_array[1][1]="gray_core.gif";
img_array[2][0]="black_method.gif";
img_array[2][1]="gray_method.gif";
img_array[3][0]="black_process.gif";
img_array[3][1]="gray_process.gif";
img_array[4][0]="black_port.gif";
img_array[4][1]="gray_port.gif";
img_array[5][0]="black_request.gif";
img_array[5][1]="gray_request.gif";

//Links for images
src_array=new Array(6);
src_array[0] = "./main.html";
src_array[1] = "./srd_core.html";
src_array[2] = "./main.html";
src_array[3] = "./main.html";
src_array[4] = "./main.html";
src_array[5] = "./main.html";

function getInitialImages(){
	//alert(img_array.length);
	var doc_str = "";
	for(i=0;i<img_array.length;i++){
		doc_str += "<tr><td align='right'>" +
			"<img border='0' src='./images/" +
			img_array[i][0] +
			"' onMouseOver='changeImages(" + i + ")'" +
			" onMouseOut='resetImages()'" +
			" onClick='setClicked(" + i + ")'" +
			">" +
			"</td></tr>\n";
	}
	//alert(doc_str);
	return doc_str;
}

function setClicked(option){
	isClicked = option;
	beenClicked = true;
	changeImages();
	if(isOpen &&NFW!=null){
		NFW.close();
	}	
	openFrameless(src_array[option]);
}

function resetImages(){
	if(!beenClicked){
		//if something has not been yet clicked
		for(i=offset;i<(img_array.length + offset);i++){
			if(isClicked!=(i-offset)){
				document.images[i].src = getNewImage((i-offset),0);
			}
		}
	} else {
		// set it to gray if it is not clicked
		for(i=offset;i<(img_array.length + offset);i++){
			if(isClicked!=(i-offset)){
				document.images[i].src = getNewImage((i-offset),1);
			}
		}
	}
}

function getNewImage(row,column){
	return "./images/" + img_array[row][column];
}

function changeImages(option){
	for(i=offset;i<(img_array.length + offset);i++){
		if((i-offset) != option && (i-offset) != isClicked) {
			document.images[i].src = getNewImage((i-offset),1);
		} else {
			document.images[i].src = getNewImage((i-offset),0);
		}
	}
}

//***************************************************
// End Image Array
//***************************************************

function openFrameless(url_str){

  if (beIE){
    NFW = window.open("","popFrameless","fullscreen,"+s)
    NFW.blur()
    window.focus()
    NFW.resizeTo(windowW,windowH)
    NFW.moveTo(windowX,windowY)
    var frameString=""+
"<html>"+
"<head>"+
"<title>"+"ShortLabs >> Home"+"</title>"+
"</head>"+
"<frameset rows='*,0' framespacing=0 border=0 frameborder=0>"+
"<frame name='top' src='"+url_str+"' scrolling=no>"+
"<frame name='bottom' src='about:blank' scrolling='no'>"+
"</frameset>"+
"</html>"
    NFW.document.open();
    NFW.document.write(frameString)
    NFW.document.close()
  } else {
    NFW=window.open(url_str,"popFrameless","scrollbars,"+s)
    NFW.blur()
    window.focus()
    NFW.resizeTo(windowW,windowH)
    NFW.moveTo(windowX,windowY)
  }
  NFW.focus()
  if (autoclose){
    window.onunload = function(){NFW.close()}
  }

  isOpen = true;

}

function openWindow(url_str){
	//alert(url_str);
	//NFW = window.open(url_str,"ShortLabs >> Requirements","height=550,width=550");
	//NFW = window.open(url_str,"ShortLabs >> Requirements","fullscreen,"+s);
	NFW = window.open(url_str, 'ShortLabs', 'height=550,width=550'); 
   	NFW.resizeTo(windowW,windowH);
    	NFW.moveTo(windowX,windowY);
}

function resize(){
	var windowX = (screen.width/2)-(windowW/2);
	var windowY = (screen.height/2)-(windowH/2);

	//alert("Width = "+(screen.width));
	//alert("Height = "+(screen.height));

	window.resizeTo((screen.width),(screen.height - 100))
	window.moveTo(0,40);

    //window.toolbar.visible = false;
    //window.statusbar.visible = false;
    //window.scrollbars.visible = false;
    //window.personalbar.visible = false;
    //window.menubar.visible = false;
    //window.locationbar.visible = false;

    window.status = "Strategic Research and Development";

}

function resizeMe(){
	
	var windowX = 40;
	var windowY = 40;
	
	if(screen.width > 800 && screen.height > 600){
		window.resizeTo((1000),(750));
		windowX = (screen.width/2) - (1040/2);
		windowY = (screen.height/2) - (768/2);		
	} else {
		window.resizeTo(760,540);
		windowX = (screen.width/2) - (800/2);
		windowY = (screen.height/2) - (600/2);			
	}
	
	window.moveTo(windowX,windowY);
	window.status = "Strategic Research and Development";
}



function bringFront(){
	if(isOpen &&NFW!=null){
		NFW.focus();
	}
}

//--------------------------------------------------------------------------------------------

/* 
function isEmail(field,label,boolEmpty) 
Author: Amardeep Singh
Dated 17-12-2003.
Parameters : field-> The name of the field whose value is to be checked
			 label-> The label with that field to give the appropiate error message
			 boolEmpty-> It can have only two values - 1 or 0.
			 if it is 1 then the value passed can not be blank else it can b blank.
Purpose : To check the format for valid Email address.
Return Value : False if value is empty else True
*/			 

function isEmail(field,label,boolEmpty) 
{ 
	
	if(boolEmpty == 1)
	{
		if (isEmpty(field,label)==false)
			return false;			
	
	}
	else
	{
	if(!field.value)
		return true;
	}
	
	
	if (field.value.search(/^\w+((-\w+)|(\.\w+))*\@[A-Za-z0-9]+((\.|-)[A-Za-z0-9]+)*\.[A-Za-z]+$/) != -1)
		return true;
	else
	{	
		label = "Please enter the valid " + label 
		alert(label);
        field.focus();
        return false;
     }   
}

//--------------------------------------------------------------------------------------------

/*
function validAddress(field,label,boolEmpty)
Author: Amardeep Singh
Dated 17-12-2003.
Parameters : field-> The name of the field whose value is to be checked
			 label-> The label with that field to give the appropiate error message
			 boolEmpty-> It can have only two values - 1 or 0.
			 if it is 1 then the value passed can not be blank else it can b blank.
Purpose : To check the valid address.
Return Value : False if date is invalid else True.
*/

function validAddress(field,label,boolEmpty)
{
	if(boolEmpty == 1)
	{
		if (isEmpty(field,label)==false)
			return false;			
	
	} 
	else
	{
	if( !field.value)
		return true;
	}

	   	var valid = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789-()'',.#/ "  
        var input = field.value;
   	    var length = input.length;
        for(i=0;i<length;i++)
        {
	         var sub=input.substring(i,i+1);
	         if(valid.indexOf(sub)==-1)
   	         {
	   	         label = "Please enter the valid " + label + " before submitting the form"
		         alert(label);
                 field.focus();
                 return false;		
	         }	
	   
	    }
	
	return true;       
}

//------------------------------------------------------------------------------------------------------------------------------

/*
function validPhone(field,label,boolEmpty)
Author: Amardeep Singh
Dated 17-12-2003.
Parameters : field-> The name of the field whose value is to be checked
			 label-> The label with that field to give the appropiate error message
			 boolEmpty-> It can have only two values - 1 or 0.
			 if it is 1 then the value passed can not be blank else it can b blank.
Purpose : To check the valid address.
Return Value : False if date is invalid else True.
*/


function validPhone(field,label,boolEmpty)
{
	
	if(boolEmpty == 1)
	{
		if (isEmpty(field,label)==false)
			return false;			
	
	}
	else
	{
	if(!field.value)
		return true;
	}

		var valid = "0123456789- " 
     	var input = field.value;
   	    var length = input.length;
        for(i=0; i<length; i++)
        {
	         var sub=input.substring(i,i+1);
	         if(valid.indexOf(sub)==-1)
   	         {
	 	         label = "Please enter the valid " + label + " before submitting the form"
	             alert(label);
                 field.focus();
                 return false;		
	          }	
	   
	    }
	         
	return true;
}

//------------------------------------------------------------------------------------------------------------------------------

/* 
function loginName(field,label,minChar)
Author: Amardeep Singh
Dated 17-12-2003.
Parameters : field-> The name of the field whose value is to be checked
			 label-> The label with that field to give the appropiate error message
			 minChar-> Minimum characters of which the login name can be.
Purpose : To check the format of login name.
Return Value : False if value is empty or in invalid format else True
*/			 

function loginName(field,label,minChar)
{
	if (isEmpty(field,label)==true)
	{
		 var valid = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789_";
		var input = field.value;
		var length = input.length;
		for(i=0; i<length; i++)
		{
			var sub = input.substring(i,i+1);
			if(valid.indexOf(sub)==-1)
	   		{
	   			 label = "Please enter the valid " + label + " before submitting the form";
				alert(label);
				field.focus();
				return false;		
			}	
		}

		if (!isCharsInBag( field.value.charAt(loginName.length - 1), "QWERTYUIOPASDFGHJKLZXCVBNMabcdefghijklmnopqrstuvwxyz0123456789"))
		{
			alert( Label + " must end in an alphanumeric character.");
			field.focus();
			return false;
		}
    
		if (!isCharsInBag( field.value.charAt(0), "QWERTYUIOPASDFGHJKLZXCVBNMabcdefghijklmnopqrstuvwxyz0123456789"))
		{
			alert( label + " name must start with an alphanumeric character.");
			field.focus();
			return false;
		}
    
		if (field.value.length < minChar)
		{
			alert( label +  " must be " + minChar + " or more characters." );
			field.focus();
			return false;
		}
	
	else
	
	{
		return false;	
	}	
}
	return true;
}    

//-----------------------------------------------------------------------------------------------------------------------------------

/* 
function Trim(str)
Author: Amardeep Singh
Dated 17-12-2003.
Parameters : str -> String which is to be trimmed
Purpose : To trim the spaces of string.
Return Value : Trimmed string
*/			 

function Trim(str)
{
	
	var resultStr = "";
	
	resultStr = TrimLeft(str);
	resultStr = TrimRight(resultStr);
	
	return resultStr;
}

//-------------------------------------------------------------------------------------------------------------------------------

/* 
function TrimLeft(str)
Author: Amardeep Singh
Dated 17-12-2003.
Parameters : str -> String which is to be trimmed
Purpose : To trim the spaces on the left of string.
Return Value : String with spaces trimmed from left
*/			 

function TrimLeft( str ) 
{
	var resultStr = "";
	var i = len = 0;

	if (str+"" == "undefined" || str == null)	
		return null;

	str += "";

	if (str.length == 0) 
		resultStr = "";
	else {	
	  	len = str.length - 1;
		len = str.length;
		
  		while ((i <= len) && (str.charAt(i) == " "))
			i++;
  		resultStr = str.substring(i, len);
  	}

  	return resultStr;
}

//-------------------------------------------------------------------------------------------------------------------------------

/* 
function TrimRight(str)
Author: Amardeep Singh
Dated 17-12-2003.
Parameters : str -> String which is to be trimmed
Purpose : To trim the spaces on the right of string.
Return Value : String with spaces trimmed from right
*/			 


function TrimRight( str ) 
{
	var resultStr = "";
	var i = 0;
	if (str+"" == "undefined" || str == null)	
		return null;

	str += "";
	
	if (str.length == 0) 
		resultStr = "";
	else {
  		i = str.length - 1;
  		while ((i >= 0) && (str.charAt(i) == " "))
 			i--;
 			
  		resultStr = str.substring(0, i + 1);
  	}
  	
  	return resultStr;  	
}
//--------------------------------------------------------------------------------------------
/* 
function isEmpty(field,label)
Author: Amardeep Singh
Dated 17-12-2003.
Parameters : field-> The name of the field whose value is to be checked
			 label-> The label with that field to give the appropiate error message
Purpose : To check if the value of field is null or not.
Return Value : False if value is empty else True
*/			 

function isEmpty(field,label)
{
	if(Trim(field.value) == "")
	{
		 label = label +   " cannot be left blank."
	     alert(label)
	     field.focus()
	     return false;
	}
	else
    {
       return true;
    }
	       
}
//--------------------------------------------------------------------------------------------

/* 
function NameChk(field,label,boolEmpty,boolNum,splChar)
Author: Amardeep Singh
Dated 17-12-2003.
Parameters : field-> The name of the field whose value is to be checked
			 label-> The label with that field to give the appropiate error message
			 boolEmpty-> It can have only two values - 1 or 0.
			 if it is 1 then the value passed can not be blank else it can be blank.
			 boolNum->It can have only two values - 1 or 0.
			 if it is 1 then the value passed can not have numeric values else it can have numeric values.
			 splChar-> Will contain the string of special characters allowed in the field.
Purpose : To check the format of each type of name.For Eg: FirstName,LastName etc etc.
Return Value : False if value is empty else True
*/			 


function NameChk(field,label,boolEmpty,boolNum,splChar)
{		
	if(boolEmpty == 1)
	{
		if (isEmpty(field,label)==false)
			return false;			
	
	}
	else
	{
	if( !field.value)
		return true;
	}
					
   	var valid = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ"; 
	if(boolNum == 0)
	{
		valid = valid + "0123456789"
	}   	
		
	valid = valid + splChar
    var input = field.value;
    var length = input.length;
	for(i=0; i<length; i++)
	{
		var sub = input.substring(i,i+1);
		if(valid.indexOf(sub)==-1)
	   	{	
	   		if (input.charAt(i)==" ")
	   			 label = "Spaces are not allowed in " + label;
	   		else
	   			 label = ' Special characters like "'+input.charAt(i)+'" are not allowed in '+ label +unescape('\n\n')+" Please enter the valid  " + label + " before submitting the form";
			
			 alert(label);
             field.focus();
             return false;		
	     }	
	   
	 }
	return true;
}

