//***************************************************************//
function SetCookie (name, value) {
var expDate = new Date();
var oneYear = (7 * 24 * 60 * 60 * 1000) * 52;
expDate.setTime (expDate.getTime() + oneYear);
document.cookie = name + "=" + escape(value) + ";" + "expires=" + expDate.toGMTString();
}
//***************************************************************//
function GetCookie (name) {
var result = null;
var myCookage = " " + document.cookie + ";";
var searchName = " " + name + "=";
var startCookie = myCookage.indexOf(searchName);
var endCookie;
   if (startCookie != -1 ) {
   startCookie += searchName.length;
   endCookie = myCookage.indexOf(";",startCookie);
   result = unescape(myCookage.substring(startCookie, endCookie));
   }
   return result;
}
/////////////////////////////////////////////////////////////////////////////////////////
var settings1		=
"toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=yes,resizable=yes,width=580,height=580";
var settings2		=
"toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=no,resizable=no,width=560,height=580";
var settings3		=
"toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=no,resizable=no,width=250,height=250";

/*********************************************************/
function popupScrolling(windowName) {
    if (window.Pop == null ||window.Pop.closed) {
        var newWin = window.open(windowName,"Pop",settings1);
    } else {
        var newWin = window.Pop.location=windowName;
    }
    newWin.focus();
}
/*********************************************************/
function popupNoScrolling(windowName) {
    if (window.PopNoScroll == null || window.PopNoScroll.closed) {
        var newWin = window.open(windowName,"PopNoScroll",settings2);
    } else {
        var newWin = window.PopNoScroll.location=windowName;
    }
    newWin.focus();
}
/*********************************************************/
function popupNoScrollingRating(windowName) {
    if (window.PopNoScrollRating == null ||window.PopNoScrollRating.closed) {
        var newWin = window.open(windowName,"PopNoScrollRating",settings2);
    } else {
        var newWin = window.PopNoScrollRating.location=windowName;
    }
    newWin.focus();
}

function popupAudioPlayer() {
var newWin = window.open("audioPlayer.jsp","AudioPopNoScroll",settings3)
}

/*********************************************************/
// Checks that all fields (text,textarea,file) that start with 'required' are filled out
// Provides an alert box pointing out if a required field has been left empty
// e.g. fieldname = requiredName   alert message = Name field is required
// Pass the field to be checked
function checkRequired(which) {
       
       var pass=true;
       var shortFieldName;
       var tempobj;
       
       if (document.images) {
           for (i=0;i<which.length;i++) {
               tempobj=which.elements[i];
               if (tempobj.name.substring(0,8)=="required") {
                   if (((tempobj.type=="text"||tempobj.type=="textarea"||tempobj.type=="file")&&
                       tempobj.value=='')||(tempobj.type.toString().charAt(0)=="s"&&
                           tempobj.selectedIndex==0)) {
                       pass=false;
                       shortFieldName=tempobj.name.substring(8,60);
                       break;
                   }
               }
           }
      }
      if (!pass) {
          alert(shortFieldName+" field is required.");
          tempobj.focus();
          return false;
      }
      else
          return true;
      
}
//***************************************************************//
function sendPop (link) {
   window.open('/sendToFriend.jsp?LINK='+link,'westsend','width=500,height=320,scrollbars=no,status=yes');
}
