var newwindow;

function hoverOn(div){
    alert(div);
}

function RewardsReferAFreindEmail(url) {
    newwindow=window.open( url, 'raf_email', 'height = 425, width = 640, resizeable = 0, top = 50, left = 100, scrollbars = yes' );
    if (window.focus) {newwindow.focus()}
}

function DiabetesReportPopup(url) {
    newwindow=window.open( url, 'diabetes_report', 'height = 950, width = 808, resizeable = 0, top = 50, left = 100, scrollbars = yes' );
    if (window.focus) {newwindow.focus()}
}

function TourPopup(url) {
    newwindow=window.open( url, 'tour', 'height = 600, width = 950, resizeable = 0, top = 50, left = 100' );
    if (window.focus) {newwindow.focus()}
}

function ConversionsPopup(url) {
    newwindow=window.open( url, 'tour', 'height = 470, width = 380, resizeable = 0, top = 50, left = 250' );
    if (window.focus) {newwindow.focus()}
}
function SnackPopup(url) {
    newwindow=window.open( url, 'snack', 'height = 600, width = 650, resizeable = 0, top = 50, left = 100, scrollbars = yes' );
    if (window.focus) {newwindow.focus()}
}
function WhySnackPopup(url) {
    newwindow=window.open( url, 'whysnack', 'height = 500, width = 700, resizeable = 0, top = 50, left = 100' );
    if (window.focus) {newwindow.focus()}
}
function FeaturedRecipePopup(url) {
    newwindow=window.open( url, 'recipe', 'height = 600, width = 900, resizeable = 0, top = 50, left = 100, scrollbars = yes' );
    if (window.focus) {newwindow.focus()}
}
function DiabetesInfoPopup(url) {
    newwindow=window.open( url, 'dbinfo', 'height = 600, width = 950, resizeable = 0, top = 50, left = 100' );
    if (window.focus) {newwindow.focus()}
}
function DiabetesAtRiskPopup(url) {
    newwindow=window.open( url, 'dbinfo', 'height = 600, width = 950, resizeable = 0, top = 50, left = 100, scrollbars = yes' );
    if (window.focus) {newwindow.focus()}
}
function ReadyToMove(url) {
    newwindow=window.open( url, 'readytomove', 'height = 600, width = 750, resizeable = 0, top = 50, left = 100, scrollbars = yes' );
    if (window.focus) {newwindow.focus()}
}
function PopupDiabetesPhase1(url) {
    newwindow=window.open( url, 'dbp1', 'height = 600, width = 950, resizeable = 0, top = 50, left = 100' );
    if (window.focus) {newwindow.focus()}
}
function PopupDiabetesPhase1and2(url) {
    newwindow=window.open( url, 'dbp12', 'height = 600, width = 950, resizeable = 0, top = 50, left = 100' );
    if (window.focus) {newwindow.focus()}
}
function IntensityLevelPopup(url) {
    newwindow=window.open( url, 'intensity', 'height = 600, width = 650, resizeable = 0, top = 50, left = 100' );
    if (window.focus) {newwindow.focus()}
}
/* Phase one Pop up */
function Phase1(url) {
	newwindow=window.open( url, 'name', 'height = 900, width = 590, resizeable = 0, top = 50, left = 300' );
	if (window.focus) {newwindow.focus()}
}

/* Phase one and two Pop up */
function Phase1and2(url) {
	newwindow=window.open( url, 'name', 'height = 620, width = 598, resizeable = 0, top = 100, left = 300' );
	if (window.focus) {newwindow.focus()}
}

/* Phase one RECOMEMNDED Pop up */
function Phase1rec(url, name) {
	newwindow=window.open(url, name, 'height = 700, width = 650, resizeable = 0, top = 100, left = 300, scrollbars = yes');
	if (window.focus) {newwindow.focus()}
}


/* Phase two and three RECOMMENDED Pop up */
function Phase2and3rec(url) {
	newwindow=window.open( url, 'name', 'height = 620, width = 590, resizeable = 0, top = 150, left = 300' );
if (window.focus) {newwindow.focus()}
}

/* Lost Password Pop up */
function lpPop(url) {
	newwindow=window.open( url, 'name', 'height = 490, width = 590, resizeable = 0, top = 150, left = 300' );
if (window.focus) {newwindow.focus()}
}

function clearDefault(el) {
  if (el.defaultValue==el.value) el.value = "";
}

///Ed's Additions 12/7/2008
function EditFoodPop(url) {
	newwindow=window.open( url,'Editfood', 'height = 350, width = 590,toolbar= 0, resizeable = 0, top = 50, left = 300' );
	if (window.focus) {newwindow.focus()}
}


function refreshSubmitParent(form,url) {
	 
    if (window.opener && !window.opener.closed) {
        document.getElementById(form).submit();
        //window.opener.location.reload();
        //window.opener.document.location.href = url;
        //window.opener.parent.document.location.href = url;
        //setTimeout(window.opener.document.location.href=url,5000);
        window.opener.parent.document.location.href = url + '&page=popuprefresh';
        //setTimeout('window.opener.parent.document.location.href=\''+url+'\'',2000);
    }
//    window.close();
  }
  
    function refreshSubmitParent2(form) {
     if (window.opener && !window.opener.closed) {
    document.getElementById(form).submit();
    }
   
  }
  function reloadclose(){
      window.opener.location.reload();
      setTimeout('window.close()', 100);
  }

function PopGrocery(url) {
	newwindow=window.open( url, 'Groceries', 'height = 900, width = 590, resizeable = 0, top = 50, left = 300, scrollbars=yes' );
	if (window.focus) {newwindow.focus()}
}

//Meg's  new popup 12/7/2008

function PopNutrition(url) {
	newwindow=window.open(url, 'nutrician','height = 640, width = 585, resizeable = 0 top = 0, left = 0');
	if (window.focus) {newwindow.focus()}
}

function SearchFood(url, name, height) {
	window.open(url,  name, 'width= 600 ,height=' + height + ',scrollbars = yes, toolbars = no,resizable = no, top = 150, left = 300'); 
	if (window.focus) {newwindow.focus()}
}

function ViewNutritionLabel(url, name, height, top, left) {
 	window.open(url,  name, 'width= 340 ,height=' + height + ',scrollbars = yes, toolbars = no,resizable = no, top = ' + top + ', left = ' + left);
	if (window.focus) {newwindow.focus()}
}

function DefaultPop(url, name, height) {
	window.open(url, name, 'width= 760 ,height=' + height + ',scrollbars = yes, toolbars = no,resizable = no, top = 150, left = 300');
	if (window.focus) {newwindow.focus()}
}

function productLocatorFetch() {
	alert('hi');
	var search_url='http://productlocator.infores.com/productlocator/servlet/ProductLocatorEngine?clientid=105&productfamilyid=BEST&producttype=upc';
	alert(search_url);
	alert(document.getElementById("zip").value);
 	//search_url += '&productid=' + document.getElementById('product').value;
	//alert(search_url);
  //search_url += '&zip=' + document.getElementById('zip').value;
	//alert(search_url);
 // document.getElementById('results').src = search_url;
}
