var win = null;
function NewWindow(mypage,myname,w,h,scroll){
LeftPosition = (screen.width) ? (screen.width-w)/2 : 0;
TopPosition = (screen.height) ? (screen.height-h)/2 : 0;
settings =
'height='+h+',width='+w+',top='+TopPosition+',left='+LeftPosition+',scrollbars='+scroll+',toolbar=0,resizable=1,location=0,directories=0'
win = window.open(mypage,myname,settings)
}

//Search Validator Start
function searchValidator() {
  var searchval = document.getElementById('searchtxtbox');
   if ((searchval.value.length == 0) || (searchval.value == 'Quick Search')) {
        alert("Please enter a search value.");
        searchval.focus();
        return false;
   } else {
       document.searchform.submit();
   }
}
//Search Validator End

//Date Function Start
var now = new Date();
var mName = now.getMonth() + 1;
var dName = now.getDay() + 1;
var dayNr = now.getDate();
var yearNr=now.getYear();
if(dName==1) Day = "Sunday";
if(dName==2) Day = "Monday";
if(dName==3) Day = "Tuesday";
if(dName==4) Day = "Wednesday";
if(dName==5) Day = "Thursday";
if(dName==6) Day = "Friday";
if(dName==7) Day = "Saturday";
if(mName==1) Month = "January";
if(mName==2) Month = "February";
if(mName==3) Month = "March";
if(mName==4) Month = "April";
if(mName==5) Month = "May";
if(mName==6) Month = "June";
if(mName==7) Month = "July";
if(mName==8) Month = "August";
if(mName==9) Month = "September";
if(mName==10) Month = "October";
if(mName==11) Month = "November";
if(mName==12) Month = "December";
if(yearNr < 2000) Year = 1900 + yearNr;
else Year = yearNr;
var todaysDate =(" " + Day + ", " + " " + Month + " " + dayNr + ", " + Year);
//Date Function End

function feedbackForm() {
  var multitext = document.getElementById('urmssg');
  var age = document.getElementById('urage');
  var gender = document.getElementById('urgender');
  var designation = document.getElementById('designation');

  if (age.value=='') {
    alert("Please enter your age.");
    age.focus();
    return false;
  } else {
     if (gender.value=='') {
        alert("Please enter your gender.");
        gender.focus();
        return false;
    } else {
       if (designation.value=='') {
          alert("Please enter your designation.");
          designation.focus();
          return false;
       } else {
        if (multitext.value=='') {
        alert("Please enter some comment/suggestion.");
        multitext.focus();
        return false;
        } else {
          return true;
        }
      }
    }
  }
}

function sendpageForm() {
  var frndemail = document.getElementById('frndemail');

  if (frndemail.value=='') {
    alert("Please enter your Friend's E-mail.");
    frndemail.focus();
    return false;
  } else {
      //check if valid email
      var emailExp = /^[\w\-\.\+]+\@[a-zA-Z0-9\.\-]+\.[a-zA-z0-9]{2,4}$/;
      //check if valid email
     if(frndemail.value.match(emailExp)) {
      return true;
      }else{
      alert("Invalid email. Please enter a valid e-mail to able us to send the page to your friend.");
     frndemail.focus();
     return false;
    }
  }
}



function popUp(URL) {
day = new Date();
id = day.getTime();
eval("page" + id + " = window.open(URL, '" + id + "', 'toolbar=0,scrollbars=0,location=0,statusbar=0,menubar=0,resizable=0,width=330,height=315,left = 265,top = 136');");
}

var new_win = '';
var new_gal_win = '';
var str='';
function gallerywindow(str){
if (!new_gal_win.closed && new_gal_win.location) {
        alert("Photo Gallery Viewer is already open.");
		new_gal_win.location.href = str;
	}
	else {
		new_gal_win=window.open(str,'myGallery','fullscreen,toolbar=0,resizable=1,scrollbars=1,location=0,directories=0');
		if (!new_gal_win.opener) new_gal_win.opener = self;
	}
	if (window.focus) {new_gal_win.focus()}
}


function checktestipost() {
  var vname = document.getElementById('name');
  var testi = document.getElementById('testi');
  var code = document.getElementById('code');
  
  if (vname.value=='') {
    alert("Please enter your Name.");
    vname.focus();
    return false;
  } else {
    if (testi.value=='') {
        alert("Please enter your Testimonial.");
        testi.focus();
        return false;
    } else {
      if (code.value=='') {
        alert("Please enter the code from the image below the text box.");
        code.focus();
        return false;
      } else {
        return true;
      }
    }
  }
}
