function HVC_prn_validateSubmit(id) {
var prnNumber = document.getElementById(id + "_prnNumber");
var prnZipCode = document.getElementById(id + "_prnZipCode");
clearError(id + '_prnNumber');
clearError(id + '_prnZipCode');

var errorFlag = false;
if(prnNumber.value.length < 1) {
    showError('Please provide Priority Reservation Number', id + '_prnNumber');
    errorFlag = true;
}else if(prnNumber.value.length > 12 || !isAlphanumeric(prnNumber.value)){
    showError('Please provide valid Priority Reservation Number (PRN)', id + '_prnNumber');
    errorFlag = true;
}

if(prnZipCode.value.length < 1) {
    showError('Please provide zip code', id + '_prnZipCode');
    errorFlag = true;
}else if(!validateZIP(prnZipCode.value)) {
    showError('Please provide valid zip code', id + '_prnZipCode');
    errorFlag = true;
}

return !errorFlag;
}

function validateZIP(field) {
var valid = "0123456789-";
var hyphencount = 0;

if (field.length!=5 && field.length!=6) {
return false;
}
for (var i=0; i < field.length; i++) {

temp = "" + field.substring(i, i+1);
if (temp == "-") hyphencount++;
if (valid.indexOf(temp) == "-1") {
return false;
}
if ((hyphencount > 1) || ((field.length==10) && ""+field.charAt(5)!="-")) {
return false;
   }
}
return true;
}

function isAlphanumeric(alphane)
{
    var numaric = alphane;
    for(var j=0; j<numaric.length; j++)
        {
          var alphaa = numaric.charAt(j);
          var hh = alphaa.charCodeAt(0);
          if((hh > 47 && hh<58) || (hh > 64 && hh<91) || (hh > 96 && hh<123))
          {
          }
        else    {
             return false;
          }
        }
 return true;
}


function showError(msg, id) {
    var errorElem = document.getElementById(id + "_error");
    if (!errorElem) {
        alert(msg);
    } else {
        errorElem.innerHTML = msg;
    }
}

function clearError(id) {
    var errorElem = document.getElementById(id + "_error");
    errorElem.innerHTML = "";
}
/*Photogallary link function*/
var popWinWidthPhotoG = ($.browser.webkit)?1022:1020;
var popWinHeightPhotoG = 637;
var popWinTopPhotoG = (screen.availHeight-popWinHeightPhotoG)/2;
var popWinLeftPhotoG =(screen.availWidth-popWinWidthPhotoG)/2;

$('.photogalleryLink').click(function(){
var newWinPhotoG = window.open(this.href,'vtour','width='+popWinWidthPhotoG+',height='+popWinHeightPhotoG+',status=0,resizable=0,scrollbars=0,location=0');
newWinPhotoG.moveTo(popWinLeftPhotoG, popWinTopPhotoG);
newWinPhotoG.focus();
return false;
})
/*Photogallary link function ends*/
/*Virtual tour popUp Opener begin*/

    var popWinWidth = 801;
    var popWinHeight = 581;
    var popWinTop = (screen.availHeight-popWinHeight)/2;
    var popWinLeft =(screen.availWidth-popWinWidth)/2;
    

    $('.VirtualTourLink').click(function(){
                    var newWin = window.open(this.href,'vtour','width='+popWinWidth+',height='+popWinHeight+',status=0,resizable=0,scrollbars=0,location=0');
                        newWin.moveTo(popWinLeft, popWinTop);
                        newWin.focus();
                        return false;
                        }
                    )
/*Virtual tour popUp Opener End*/ 

