var req = null;
var which;
function retrieveURL(url, divid) {
	var response = "<tr><td valign='middle'><p align='left'><img src='/awinimages/19.gif'>&nbsp;</td></tr>";
    document.getElementById(divid).innerHTML = response;
    if (window.XMLHttpRequest) { // Non-IE browsers
        req = new XMLHttpRequest();
        req.onreadystatechange = function () {
            processStateChange(divid);
        };
        try {
            req.open("POST", url, true);
        }
        catch (e) {
            alert(e);
        }
        req.send(null);
    } else {
        if (window.ActiveXObject) { // IE
            req = new ActiveXObject("Microsoft.XMLHTTP");
            if (req) {
                req.onreadystatechange = function () {
                    processStateChange(divid);
                };
                req.open("POST", url, true);
                req.send();
            }
        }
    }
}
function processStateChange(divid) {
    if (req.readyState == 4) { // Complete
        if (req.status == 200) { // OK response     
            document.getElementById(divid).innerHTML = req.responseText;
        } else {
            redirectToErrorPage(divId);
        }
    }
}  

function toggle(id,displayid) {
var ele = document.getElementById(id);
var text = document.getElementById(displayid);
if(ele.style.display == "block") {
ele.style.display = "none";
text.innerHTML = "<img src='/awinimages/icons/form-max.gif' name='test' width='9' height='9' border='0'>&nbsp;See articles";
}
else {
ele.style.display = "block";
text.innerHTML = "<img src='/awinimages/icons/form-min.gif' name='test' width='9' height='9' border='0'>&nbsp;Hide articles";
}
} 

//this switches expand collapse icons
function filterImage(imagename, objectsrc) {
    if (document.images) {
        document.images[imagename].src = eval(objectsrc + ".src");
    }
}

//show OR hide funtion depends on if element is shown or hidden
function toggleImage(id) { 
    imgout = new Image(20, 20);
    imgin = new Image(9, 9);
    imgout.src = "/awinimages/icons/form-max.gif";
    imgin.src = "/awinimages/icons/form-min.gif";
    if (document.getElementById) { // DOM3 = IE5, NS6
        if (document.getElementById(id).style.display == "none") {
            document.getElementById(id).style.display = "block";
            filterImage(("img" + id), "imgin");
        } else {
            filterImage(("img" + id), "imgout");
            document.getElementById(id).style.display = "none";
        }
    } else {
        if (document.layers) {
            if (document.id.display == "none") {
                document.id.display = "block";
                filterImage(("img" + id), "imgin");
            } else {
                filterImage(("img" + id), "imgout");
                document.id.display = "none";
            }
        } else {
            if (document.all.id.style.visibility == "none") {
                document.all.id.style.display = "block";
            } else {
                filterImage(("img" + id), "imgout");
                document.all.id.style.display = "none";
            }
        }
    }
}

function createProfile(){
var specifiedForm = document.myAwinProfileForm;



if(specifiedForm.profileName.value == null){
	alert("Please enter profile name.");
	return false;
}
    if(specifiedForm.searchText.value == ""
        && specifiedForm.allWords.value == ""
        && specifiedForm.exactPhrase.value == ""
        && specifiedForm.anyWords.value == ""
        && specifiedForm.noneOfTheseWords.value == "") {
	    alert("Please enter search text.");
	    return false;
    } else if (specifiedForm.database.value == "no_resource"){
		alert("Sorry, no information resources available");
		return false;
	} else {
        var flag = false;
        //alert ("length = " + specifiedForm.database.length);
        for (var i=0; i<specifiedForm.database.length; i++) {
            if (specifiedForm.database[i].checked)  {
                flag = true;
                break;
            }
        }

       if(!flag) {
            alert("Please choose at least 1 information source.");
            return false;
        } else {        
        	  specifiedForm.action = "/personalization/myawin/myAwinProfile.do?parameter=myAwinProfileOperations&searchAction=insert";
    		  specifiedForm.submit();     
           
        }
    }
}

function resetForm(){
	document.myAwinProfileForm.allWords.value="";
    document.myAwinProfileForm.exactPhrase.value="";
    document.myAwinProfileForm.anyWords.value="";
    document.myAwinProfileForm.noneOfTheseWords.value="";
    document.myAwinProfileForm.searchText.value="";

    document.myAwinProfileForm.dateSettings[0].checked=true;

    for (var i=0; i<document.myAwinProfileForm.mfrom.options.length; i++) {
        document.myAwinProfileForm.mfrom.options[i].selected = false;
        document.myAwinProfileForm.mfrom.options[0].selected = true;
    }
    for (var i=0; i<document.myAwinProfileForm.dfrom.options.length; i++) {
        document.myAwinProfileForm.dfrom.options[i].selected = false;
        document.myAwinProfileForm.dfrom.options[0].selected = true;
    }
    for (var i=0; i<document.myAwinProfileForm.yfrom.options.length; i++) {
        document.myAwinProfileForm.yfrom.options[i].selected = false;
        document.myAwinProfileForm.yfrom.options[0].selected = true;
    }
    for (var i=0; i<document.myAwinProfileForm.numPerPage.options.length; i++) {
        document.myAwinProfileForm.numPerPage.options[i].selected = false;
        document.myAwinProfileForm.numPerPage.options[0].selected = true;
    }
    document.myAwinProfileForm.displaySummary.checked = true;
    document.myAwinProfileForm.threshold.value = 15;
    for (var i=0; i<document.myAwinProfileForm.database.length; i++) {
        document.myAwinProfileForm.database[i].checked = true;
    }
}

function popup(){
 window.open("/awin/awin_search_tips.jsp","_blank", "resizable=yes,toolbar=no,menubar=no,location=no,scrollbars=yes,status=no,height=400,width=285,screenX=500,screenY=500,top=200,left=500");
}
function popup_top(){
 window.open("/avweek1/search_tip.html#top","_blank", "resizable=yes,toolbar=no,menubar=no,location=no,scrollbars=yes,status=no,height=400,width=285,screenX=500,screenY=500,top=200,left=500");
}
function popup_relev_date(){
 window.open("/awin/awin_search_tips.jsp#relev_date","_blank", "resizable=yes,toolbar=no,menubar=no,location=no,scrollbars=yes,status=no,height=400,width=285,screenX=500,screenY=500,top=200,left=500");
}
function popup_pubname(){
 window.open("/awin/awin_search_tips.jsp#pub_name","_blank", "resizable=yes,toolbar=no,menubar=no,location=no,scrollbars=yes,status=no,height=400,width=285,screenX=500,screenY=500,top=200,left=500");
}
function popup_from_to(){
 window.open("/awin/awin_search_tips.jsp#from_to","_blank", "resizable=yes,toolbar=no,menubar=no,location=no,scrollbars=yes,status=no,height=400,width=285,screenX=500,screenY=500,top=200,left=500");
}
function popup_summary(){
 window.open("/awin/awin_search_tips.jsp#summary","_blank", "resizable=yes,toolbar=no,menubar=no,location=no,scrollbars=yes,status=no,height=400,width=285,screenX=500,screenY=500,top=200,left=500");
}
function popup_threshold(){
 window.open("/awin/awin_search_tips.jsp#threshold","_blank", "resizable=yes,toolbar=no,menubar=no,location=no,scrollbars=yes,status=no,height=400,width=285,screenX=500,screenY=500,top=200,left=500");
}
function popup_search_assistant(){
 window.open("/awin/awin_search_tips.jsp#search_asst","_blank", "resizable=yes,toolbar=no,menubar=no,location=no,scrollbars=yes,status=no,height=400,width=285,screenX=500,screenY=500,top=200,left=500");
}
function popup_natural_language(){
 window.open("/awin/awin_search_tips.jsp#nat_lang","_blank", "resizable=yes,toolbar=no,menubar=no,location=no,scrollbars=yes,status=no,height=400,width=285,screenX=500,screenY=500,top=200,left=500");
}


function check_query_type () {
    for (i = 0; i < 2; i ++) {
      if (document.myAwinProfileForm.queryType[i].value == "assistant") {
         document.myAwinProfileForm.searchText.value = "";
       } else if (document.myAwinProfileForm.queryType[i].value == "expertQuery") {
         document.myAwinProfileForm.allWords.value = "";
         document.myAwinProfileForm.exactPhrase.value = "";
         document.myAwinProfileForm.anyWords.value = "";
         document.myAwinProfileForm.noneOfTheseWords.value = "";
         document.myAwinProfileForm.searchText.disabled = false;
       }
    }
}


function toggleExpertQuery(){
    document.myAwinProfileForm.queryType[1].checked=false;
    document.myAwinProfileForm.queryType[0].checked=true;
    clearSearchAssistantFields();
}

function toggleSearchAssistantQuery(){
    document.myAwinProfileForm.queryType[1].checked=true;
    document.myAwinProfileForm.queryType[0].checked=false;
    clearExpertQueryField();
}

function clearSearchAssistantFields() {
    document.myAwinProfileForm.allWords.value="";
    document.myAwinProfileForm.exactPhrase.value="";
    document.myAwinProfileForm.anyWords.value="";
    document.myAwinProfileForm.noneOfTheseWords.value="";
}

function clearExpertQueryField(){
    document.myAwinProfileForm.searchText.value="";
}

function toggleDateSelection(){
    document.myAwinProfileForm.dateSettings[1].checked=true;
}
function updateEmailCheck(url,divid) {	 	
	var params="parameter=updateEmailPref";
	var r_format=emailFormat();
	var r_frequency=emailFrequency();
	if(document.myform.email[0].checked == true)	{
		if (r_format != null && r_frequency !=null ) {		 	
	 	url = url + "&resultsview=email"; 
	 	params=params+"&resultsview=email";
	 	url = url + "&frequency=" + r_frequency; 
	 	params=params+"&frequency=" + r_frequency;
	 	url = url + "&format=" + r_format; 	 	
	 	params=params+"&format=" + r_format;

	 	//document.myform.udp.disabled = false;
	 	updateEmailPref(url, divid,params)	
	 	}
	 	else{
	 		if(r_format == null && r_frequency ==null )
	 		{
	 		alert("Please select the mail format and frequency");
	 		//document.myform.email[0].checked=false;
	 		//document.myform.email[1].checked=true;
	 		//document.myform.udp.disabled = true;
	 		}
	 		else if(r_frequency ==null)
	 		{
	 		alert("Please select the mail frequency");
	 	//	document.myform.email[0].checked=false;
	 		//document.myform.email[1].checked=true;
	 		//document.myform.udp.disabled = true;
	 		}
	 		else{
	 			alert("Please select the mail format");
	 			//document.myform.email[0].checked=false;
	 			//document.myform.email[1].checked=true;
	 			//document.myform.udp.disabled = true;
	 		}
	 		
	 	}
	 	
	}else{	
		//document.myform.udp.disabled=true;
		for (i=0;i<document.myform.format.length;i++) 
		{ 
      		document.myform.format[i].checked=false;       
	    }
	    
	    for (i=0;i<document.myform.frequency.length;i++) 
		{ 
      		document.myform.frequency[i].checked=false;     
		}	    
	    updateEmailPref(url, divid)	    
	    
	}	
}

function updateDelivery(url,divid){	
var r_format=emailFormat();
var r_frequency=emailFrequency();

if(r_format !=null){
	url = url + "&format=" + r_format; 
	params=params+"&format=" + r_format;
}
if(r_frequency !=null){
	url = url + "&frequency=" + r_frequency; 
	params=params+"&frequency=" + r_frequency;
}

if(r_format == null && r_frequency ==null )
{
	 alert("Please select the mail format and frequency");
	 document.myform.email.checked=false;
	 return false;
}
else if(r_frequency ==null)
{
	 alert("Please select the mail frequency");
	 document.myform.email.checked=false;
	  return false;
}
else if(r_format==null)
{
	 alert("Please select the mail format");
	 document.myform.email.checked=false;
	  return false;
}



updateDelivPref(url,divid,params)
}

function emailFormat()
{
var r_format=null;
	for (i=0;i<document.myform.format.length;i++) 
	{ 
      if (document.myform.format[i].checked) 
      { 
            r_format = document.myform.format[i].value;           
      } 
	}
return r_format;
	
}


function emailFrequency()
{
var r_frequency=null;
	for (i=0;i<document.myform.frequency.length;i++) 
	{ 
      if (document.myform.frequency[i].checked) 
      { 
           r_frequency = document.myform.frequency[i].value;           
      } 
	}
return r_frequency;
	
}

/*************
*    FUNCTION: updateEmailPref
* DESCRIPTION: Makes Ajax call to display the Personnels information 
*      AUTHOR: Satyam Computer Services Ltd.
*     HISTORY: 
*  PARAMETERS:url - action url for display the Personnels information based on OrgId*			  
*			  divId - div tag -id used to updated this portion after Ajax call returns			  
*************/
function updateDelivPref(url, divId,params) {
	var response = "<tr><td  valign='middle'><p align='left'><img src='/awinimages/19.gif'>&nbsp;</td></tr>";
    document.getElementById(divId).innerHTML = response;
    var params="parameter=updateEmailPref";
    var XMLHttpReq = createXMLHttpReq();
    XMLHttpReq.open("POST", url, true);
    XMLHttpReq.send(params);
    XMLHttpReq.onreadystatechange = function () {
        if (XMLHttpReq.readyState == 4 && XMLHttpReq.status == 500) {
             redirectToErrorPage(divId);
        } else {
            if (XMLHttpReq.readyState == 4) {
                populateDivTag(XMLHttpReq, divId);
            }
        }
    };
}

/*************
*    FUNCTION: createXMLHttpReq
* DESCRIPTION: Create and returns the Request Object Used for Ajax Calls
*      AUTHOR: Satyam Computer Services Ltd.
*     HISTORY: 
*  PARAMETERS:
*************/
function createXMLHttpReq() {
    var reqObject = null;
    try {
        reqObject = new ActiveXObject("Msxml2.XMLHTTP");
    }
    catch (e) {
    }
    try {
        reqObject = new ActiveXObject("Microsoft.XMLHTTP");
    }
    catch (e) {
    }
    try {
        reqObject = new XMLHttpRequest();
    }
    catch (e) {
    }
    return reqObject;
}
/*************
*    FUNCTION: populateDivTag
* DESCRIPTION: populates the give div witht the responce obj data. 
*      AUTHOR: Satyam Computer Services Ltd.
*     HISTORY: 
*  PARAMETERS: XMLHttpReq - Ajax Responce,
*			   divId - Id of the dig tag
*************/
function populateDivTag(XMLHttpReq, divId) {
    if (document.getElementById(divId) != null) {
        document.getElementById(divId).innerHTML = XMLHttpReq.responseText;
    }
}

/*************
*    FUNCTION: updateEmailPref
* DESCRIPTION: Makes Ajax call to display the Personnels information 
*      AUTHOR: Satyam Computer Services Ltd.
*     HISTORY: 
*  PARAMETERS:url - action url for display the Personnels information based on OrgId*			  
*			  divId - div tag -id used to updated this portion after Ajax call returns			  
*************/
function updateEmailPref(url, divId,params) {
	var response = "<tr><td  valign='middle'><p align='left'><img src='/awinimages/19.gif'>&nbsp;</td></tr>";
    document.getElementById(divId).innerHTML = response;
    var params="parameter=updateEmailPref";
    var XMLHttpReq = createXMLHttpReq();
    XMLHttpReq.open("POST", url, true);
    XMLHttpReq.send(params);
    XMLHttpReq.onreadystatechange = function () {
        if (XMLHttpReq.readyState == 4 && XMLHttpReq.status == 500) {
             redirectToErrorPage(divId);
        } else {
            if (XMLHttpReq.readyState == 4) {
                populateDivTag(XMLHttpReq, divId);
            }
        }
    };
}

/*************
* FUNCTION: getArticleProfileURL
* DESCRIPTION: Makes Ajax call to display the Personnels information 
* AUTHOR: Satyam Computer Services Ltd.
* HISTORY: 
* PARAMETERS:url - action url for display the Personnels information based on OrgId*			  
* divId - div tag -id used to updated this portion after Ajax call returns			  
*************/
function getArticleProfileURL(url, divId,params) {
	var response = "<tr><td  valign='middle'><p align='left'><img src='/awinimages/19.gif'>&nbsp;</td></tr>";
    document.getElementById(divId).innerHTML = response;    
    var params = params;       
    if (document.getElementById(divId).style.display != 'none') {    	
    	return false;
    }	 
    var XMLHttpReq = createXMLHttpReq();
    XMLHttpReq.open("POST", url, true);
    XMLHttpReq.send(params);
    XMLHttpReq.onreadystatechange = function () {
        if (XMLHttpReq.readyState == 4 && XMLHttpReq.status == 500) {
            redirectToErrorPage(divId);
        } else {
            if (XMLHttpReq.readyState == 4) {
                populateDivTag(XMLHttpReq, divId);
            }
        }
    };
}
/*************
* FUNCTION: getDataProfileURL
* DESCRIPTION: Makes Ajax call to display the Personnels information 
* AUTHOR: Satyam Computer Services Ltd.
* HISTORY: 
* PARAMETERS:url - action url for display the Personnels information based on OrgId*			  
* divId - div tag -id used to updated this portion after Ajax call returns			  
*************/
function getDataProfileURL(url, divId,params) {
	var response = "<tr><td  valign='middle'><p align='left'><img src='/awinimages/19.gif'>&nbsp;</td></tr>";
    document.getElementById(divId).innerHTML = response;    
    var params = params;        
    if (document.getElementById(divId).style.display != 'none') {    	
    	return false;
    }
    var XMLHttpReq = createXMLHttpReq();
    XMLHttpReq.open("POST", url, true);
    XMLHttpReq.send(params);
    XMLHttpReq.onreadystatechange = function () {
        if (XMLHttpReq.readyState == 4 && XMLHttpReq.status == 500) {
            redirectToErrorPage(divId);
        } else {
            if (XMLHttpReq.readyState == 4) {
                populateDivTag(XMLHttpReq, divId);
            }
        }
    };
}


function createSavedArticles(url) {
    var form = document.forms[0];
    form.action = url;
    form.submit();
    return false;
}



function viewDataSearchResult(url) {
    var form = document.forms[0];
    form.action = url;
    form.submit();
    return false;
}

function exportDataSearchResult(url) {
    var form = document.forms[0];
    form.action = url;
    form.submit();
    return false;
}

function editArticlePersonalization(url) {
    var form = document.forms[0];
    form.action = url;
    form.submit();
    return false;
}

function deleteArticlePersonalization(url) {
    var form = document.forms[0];
    form.action = url;
    form.submit();
    return false;
}

var req;
var which;
var params;
function includeEmail(url,divid,test,profSize,params){
params=params;
var myInt=null;
var prfSize=null;
var box=null;
myInt = parseInt(test);
prfSize=parseInt(profSize)
//box = eval("document.myform.email"+myInt);  
box=document.getElementById("includeemail"+myInt);
var cnt=16;
var checkCount=0;
for(i=1;i<=prfSize;i++){
if (document.getElementById("includeemail"+i).checked){
checkCount++;
if (checkCount>15){
	alert("Your Profile has included fifteen emails already");	
	box.checked=false;
	return false;
}
}
}




        if (box.checked==true) {        
        	url = url+"&includeemail=includeemail";
        	params = params+"&includeemail=includeemail";
        }  
	 	
    if (window.XMLHttpRequest) { // Non-IE browsers
        req = new XMLHttpRequest();
        req.onreadystatechange = function () {
            includeMailProcess(divid);
        };
        try {
            req.open("POST", url, true);
        }
        catch (e) {
            alert(e);
        }
        req.send(params);
    } else {
        if (window.ActiveXObject) { // IE
            req = new ActiveXObject("Microsoft.XMLHTTP");
            if (req) {
                req.onreadystatechange = function () {
                    includeMailProcess(divid);
                };
                req.open("POST", url, true);
                req.send(params);
            }
        }
    }
}

function includeMailProcess(divid) {
	var response = "<tr><td  valign='middle'><p align='left'><img src='/awinimages/19.gif'>&nbsp;</td></tr>";
    document.getElementById(divid).innerHTML = response;  
    if (req.readyState == 4) { // Complete
        if (req.status == 200) { // OK response     
            document.getElementById(divid).innerHTML = "Email Delivery Updated";
        } else {
           redirectToErrorPage(divid);
        }
    }
}

function show_prompt(url) { 
var my_string = prompt("Please Enater Favorities Name","");
var form = document.forms[0];
url = url + "&favoritiesName="+my_string; 
	form.action=url;
	form.submit();
	return false;
//alert("Welcome  "+my_string)
}


function redirectToErrorPage(divId){ 

       if (document.getElementById(divId) != null) {

        document.getElementById(divId).innerHTML = "Application error,Please contact support team";

    }

}

/*************
*    FUNCTION: createXMLHttpReq
* DESCRIPTION: Create and returns the Request Object Used for Ajax Calls
*      AUTHOR: Satyam Computer Services Ltd.
*     HISTORY: 
*  PARAMETERS:
*************/
function createXMLHttpReq() {
    var reqObject = null;
    try {
        reqObject = new ActiveXObject("Msxml2.XMLHTTP");
    }
    catch (e) {
    }
    try {
        reqObject = new ActiveXObject("Microsoft.XMLHTTP");
    }
    catch (e) {
    }
    try {
        reqObject = new XMLHttpRequest();
    }
    catch (e) {
    }
    return reqObject;
}
/*************
*    FUNCTION: populateDivTag
* DESCRIPTION: populates the give div witht the responce obj data. 
*      AUTHOR: Satyam Computer Services Ltd.
*     HISTORY: 
*  PARAMETERS: XMLHttpReq - Ajax Responce,
*			   divId - Id of the dig tag
*************/
function populateDivTag(XMLHttpReq, divId) {
    if (document.getElementById(divId) != null) {    
    alert(XMLHttpReq.responseText);	
        document.getElementById(divId).innerHTML = XMLHttpReq.responseText;
    }
}

/*************
* FUNCTION: getProfileURL
* DESCRIPTION: Makes Ajax call to display the Personnels information 
* AUTHOR: Satyam Computer Services Ltd.
* HISTORY: 
* PARAMETERS:url - action url for display the Personnels information based on OrgId*			  
* divId - div tag -id used to updated this portion after Ajax call returns			  
*************/
function getProfileURL(url, divId,parameters) {
	var response = "<tr><td  valign='middle'><p align='left'><img src='/awinimages/19.gif'>&nbsp;</td></tr>";
    document.getElementById(divId).innerHTML = response;    
    var params = parameters;    
    alert(params);
    var XMLHttpReq = createXMLHttpReq();
    XMLHttpReq.open("POST", url, true);
    XMLHttpReq.send(params);
    XMLHttpReq.onreadystatechange = function () {
        if (XMLHttpReq.readyState == 4 && XMLHttpReq.status == 500) {
            redirectToErrorPage(divId);
        } else {
            if (XMLHttpReq.readyState == 4) {
                populateDivTag(XMLHttpReq, divId);
            }
        }
    };
}
function validatePwd() {
	var invalid = " "; // Invalid character is a space
	var minLength = 6; // Minimum length
	var pw = document.changepasswordForm.pw.value;
	var pw1 = document.changepasswordForm.pw1.value;
	var pw2 = document.changepasswordForm.pw2.value;
	if (pw == '') {
		alert('Please enter your existing password.');
		pw.focus();
		return false;
	}
	// check for a value in both fields.
	if (pw1 == '' || pw2 == '') {
		alert('Please enter your password twice.');
		pw1.focus();
		return false;
	}
	// check for minimum length
	if (document.changepasswordForm.pw1.value.length < minLength) {
		alert('Your password must be at least ' + minLength + ' characters long. Try again.');
		return false;
	}
	// check for spaces
	if (document.changepasswordForm.pw1.value.indexOf(invalid) > -1) {
		alert("Sorry, spaces are not allowed.");
		return false;
	}
	else {
	if (pw1 != pw2) {
		alert ("You did not enter the same new password twice. Please re-enter your password.");
		return false;
	}
	else {
		//alert('Nice job.');
		return true;
      }
   }
}

function emailCheck(str) {
		var at="@"
		var dot="."
		var lat=str.indexOf(at)
		var lstr=str.length
		var ldot=str.indexOf(dot)
    
	    // check if '@' is at the first position or at last position or absent in given email 
            
		if (str.indexOf(at)==-1 || str.indexOf(at)==0 || str.indexOf(at)==lstr){
		   alert("Invalid E-mail ID")
		   return false
		}
        // check if '.' is at the first position or at last position or absent in given email
        
		if (str.indexOf(dot)==-1 || str.indexOf(dot)==0 || str.indexOf(dot)==lstr){
		    alert("Invalid E-mail ID")
		    return false
		}
        // check if '@' is used more than one times in given email
		if (str.indexOf(at,(lat+1))!=-1){
		    alert("Invalid E-mail ID")
		    return false
		 }
   
         // check for the position of '.'
		 if (str.substring(lat-1,lat)==dot || str.substring(lat+1,lat+2)==dot){
		    alert("Invalid E-mail ID")
		    return false
		 }
         // check if '.' is present after two characters from location of '@'         
		 if (str.indexOf(dot,(lat+2))==-1){
		    alert("Invalid E-mail ID")
		    return false
		 }
		
		 // check for blank spaces in given email
		 if (str.indexOf(" ")!=-1){
		    alert("Invalid E-mail ID")
		    return false
		 }
 		 return true					
	}
function changePassword(){
	var emailID=document.changepasswordForm.email.value;	
    var form = document.changepasswordForm;  
    validatePwd();
    ValidatePasswordForm(emailID); 
    form.action = "/changePassword.do?parameter=changePassword";
    form.submit();
    return false;	
 }
 
 
 function ValidatePasswordForm(email){
	var emailID=email;	
	if ((emailID==null)||(emailID=="")){
		alert("Please Enter your Email ID");
		emailID.focus();
		return false;
	}
	if (emailCheck(emailID)==false){
		emailID="";
		emailID.focus();
		return false;
	}
	return true;
 }
 
 function clearChangePassword(){ 
 	document.changepasswordForm.email.value='';
 	document.changepasswordForm.pw1.value='';
 	document.changepasswordForm.pw2.value='';
 	document.changepasswordForm.pw.value='';
 }





