/*
window.onerror = function(e,u,l)
{
	alert([e,u,l]);
};
*/

// JavaScript Document
var gEditWin=null;
var gImageWin=null;
var gVenueWin=null;
var gReviewWin=null;

function MM_openBrWindow(theURL,winName,features) { //v1.2
  window.open(theURL,winName,features);
  }
  
function myOpenWindow(winURL,winName,winFeatures,winObj) {
  var theWin; // this will hold our opened window
 
 //first check to see if the window already exists
 if (winObj!=null) {
   // the window has already been created, but did the user close it?
   // if so, then reopen it. Otherwise make it the active window.
   
   if (!winObj.closed) {
     winObj.focus();
	 return winObj;
	 }
	 
	 // otherwise fall through to the code below to re-open the window
	 
  }
  
  // if we get here, then the window hasn't been created yet, or it
  // was closed by the user.
  
  theWin = window.open(winURL,winName,winFeatures);
  
  return theWin; 
}

//function openGameWin() {
//  gEditWin=myOpenWindow('http://www.pmtrk.com/?d=49','conq','width=848,height=640', gEditWin);
// }

function openImageEditWin(vars) {
  
  gEditWin=myOpenWindow('http://www.backporchrevolution.com/admin/imageUpload.php?'+vars,'image_edit', 
  'width=800,height=600,toolbar=no,status=yes,scrollbars=no,resizable=yes', gEditWin);
  }

function openImageShowWin(url, winWidth, winHeight) {
  
  gImageWin=myOpenWindow(url,'image_show', 
  'width='+winWidth+',height='+winHeight+',toolbar=no,status=no,scrollbars=no,resizable=no', gImageWin);
  }
  
function openImageShowWin2(url, winWidth, winHeight, caption) {

  var newurl = "http://www.backporchrevolution.com/include/photo_full.php?src="+url+"&height="+winHeight+"&width="+winWidth+"&caption="+caption;
  
  gImageWin=myOpenWindow(newurl,'image_show', 
  'width='+winWidth+',height='+winHeight+',toolbar=no,status=no,scrollbars=no,resizable=no', gImageWin);
  }

function openSongEditWin(vars) {
  
  gEditWin=myOpenWindow('http://www.backporchrevolution.com/admin/edit_song.php?'+vars,'song_edit', 
  'width=600,height=600,toolbar=no,status=yes,scrollbars=no,resizable=yes', gEditWin);
  }

function openMp3UploadWin(vars) {
  
  gEditWin=myOpenWindow('http://www.backporchrevolution.com/admin/mp3Upload.php?'+vars,'mp3_upload', 
  'width=600,height=800,toolbar=no,status=yes,scrollbars=no,resizable=yes', gEditWin);
  }

function openEmailaddress(type) {
  thisWin = document.window;
  
  
  
    window.location.href = 'mailto:label'+type+'@backporchrevolution.com';
  
    //thisWin = myOpenWindow('mailto:label'+type+'@backporchrevolution.com','email', '', thisWin);
    /*
  	  MM_openBrWindow('mailto:label'+type+'@backporchrevolution.com','email', 
  	  'width=200,height=100,toolbar=no,status=no,scrollbars=no,resizable=no');
  	 */
  
 }
 
function includeemail(){
//	var f = document.PaypalForm;
	var f = document.getElementById("PaypalForm");
	var ename = "web_orders";
	var   at = "@";
	var  url = "backporchrevolution.com";
	f.business.value = ename + at + url;
	return true;
}

 
 function openVenueWin(venueid) {

    gVenueWin = myOpenWindow('http://www.backporchrevolution.com/venue.php?id='+venueid,'venue', 
  'width=300,height=400,toolbar=no,status=yes,scrollbars=no,resizable=yes', gVenueWin);
  }

  function openReviewWin(reviewid) {

    gReviewWin = myOpenWindow('http://www.backporchrevolution.com/review.php?id='+reviewid,'review', 
  'width=600,height=600,toolbar=no,status=yes,scrollbars=yes,resizable=yes', gReviewWin);
  }


function closeMyWin() {
    //reload parent
	 window.opener.location.reload();
     window.opener.focus();
     
    //close me
    window.close();
}

function dialog_confirm(msg, gotoURL){
	if(confirm(msg)){
		self.location=gotoURL;
	}

}


// Javascript check/uncheck all checkboxes

// by Nannette Thacker
// http://www.shiningstar.net
// This script checks and unchecks boxes on a form
// Checks and unchecks unlimited number in the group...
// Pass the Checkbox group name...
// call buttons as so:
// <input type=button name="CheckAll"   value="Check All"
	//onClick="checkAll(document.myform.list)">
// <input type=button name="UnCheckAll" value="Uncheck All"
	//onClick="uncheckAll(document.myform.list)">
// -->

function checkAll(field)
{
for (i = 0; i < field.length; i++)
	field[i].checked = true ;
}

function uncheckAll(field)
{
for (i = 0; i < field.length; i++)
	field[i].checked = false ;
}

