﻿function OpenWindow(location){
    var popW = 280, popH = 350;
    var w = screen.availWidth;
    var h = screen.availHeight;
    var leftPos = (w-popW)/2, topPos = (h-popH)/2;
    window.open('http://'+window.location.host+'/EmailFriend.php?page=' + location,'mywindow','status=0,location=0,titlebar=0,toolbar=0,menubar=0,directories=0,width=' + popW + ',height=' + popH + ',top=' + topPos + ',left=' + leftPos + '');
}
function ValidateSendArticle(){
    var pattern=/^([a-zA-Z0-9_.-])+@([a-zA-Z0-9_.-])+\.([a-zA-Z])+([a-zA-Z])+/;
    if(document.getElementById('txtNameSendArticle').value == '' && document.getElementById('txtEmailSendArticle').value == ''){
        alert('Please enter your Name and Email Address');
        return false;
    }
    if(document.getElementById('txtNameSendArticle').value == ''){
        alert('Please enter your Name');
        return false;
    }
    if(document.getElementById('txtEmailSendArticle').value == ''){
        alert('Please enter your Email Address');
        return false;
    }
    if(!pattern.test(document.getElementById('txtEmailSendArticle').value)){         
		alert('Please enter a Valid Email Address');
		return false;
    }
    return true;
}
function ShowHideDiv(){
	for(var i=0;i<SampleSizeForm.length;i++){
		if(SampleSizeForm[i].checked == true){
		    var buttonValue = SampleSizeForm[i].value;
		    if(SampleSizeForm[i].value == 'finite'){document.getElementById('hiddenDiv').style.display = 'block';}
		    else{document.getElementById('hiddenDiv').style.display = 'none';}
		}
	}
}
function UpdateSurveyMethodPrice(){
    document.getElementById('txtSurveyCost').value = '$' + document.getElementById('ddlSurveyMethodDD').options[document.getElementById('ddlSurveyMethodDD').selectedIndex].value;
}
