function UpdatePantry(linkid,iid){
new Ajax.Updater('ingredients', 'http://www.recipekey.com/therecipes/'+linkid+'/'+iid,{onLoading:function(request){$('box_main_recipe').setOpacity(0.3); $('percentage').setOpacity(0.3); Element.show('lload');},onComplete:function(request){RefreshMatch(linkid);},asynchronous:true, evalScripts:true});
}
function RefreshMatch(linkid){
new Ajax.Updater('percentage', 'http://www.recipekey.com/therecipes/'+linkid+'/refresh',{onLoading:function(request){},onComplete:function(request){$('box_main_recipe').setOpacity(1); $('percentage').setOpacity(1); Element.hide('lload');},asynchronous:true, evalScripts:true});
}
function RefreshComment(linkid){
new Ajax.Updater('comments', 'http://www.recipekey.com/therecipes/'+linkid+'/refreshc',{onLoading:function(request){},onComplete:function(request){$('writebox').setOpacity(1);  Element.hide('cload');},asynchronous:true, evalScripts:true});
}
function ChangeSS(linkid,ss){
new Ajax.Updater('ingredients', 'http://www.recipekey.com/therecipes/'+linkid+'/ss-'+ss,{onLoading:function(request){$('box_main_recipe').setOpacity(0.3); $('percentage').setOpacity(0.3); Element.show('sload');},onComplete:function(request){$('box_main_recipe').setOpacity(1); $('percentage').setOpacity(1); Element.hide('sload');},asynchronous:true, evalScripts:true});
}
function DeleteComment(commentid, linkid){
	new Ajax.Updater('comments', 'http://www.recipekey.com/recipe_post.php?dc='+commentid, {onLoading:function(request){ Element.show('cload'); $('writebox').setOpacity(.3);},onComplete:function(request){RefreshComment(linkid);},asynchronous:true, evalScripts:true});
}
function SubmitComment(linkid){
	var form = $('combox');
var comment = form['user_comment'];
var rating_user;
//rating1 = form['rating1']; if($F(rating1)){ rating_user = $F(rating1);} 
//rating2 = form['rating2']; if($F(rating2)){ rating_user = $F(rating2); } 
//rating3 = form['rating3']; if($F(rating3)){ rating_user = $F(rating3);} 
//rating4 = form['rating4']; if($F(rating4)){ rating_user = $F(rating4);} 
//rating5 = form['rating5']; if($F(rating5)){ rating_user = $F(rating5);}  
//alert(rating_user);
//new Ajax.Updater(,{onLoading:function(request){$('box_main_recipe').setOpacity(0.3); $('percentage').setOpacity(0.3); Element.show('lload');},onComplete:function(request){$('box_main_recipe').setOpacity(1); $('percentage').setOpacity(1); Element.hide('lload');},asynchronous:true, evalScripts:true});
	//alert($('user_comment').getValue());
	
	new Ajax.Updater('comments', 'http://www.recipekey.com/recipe_post.php', {onLoading:function(request){ Element.show('cload'); $('writebox').setOpacity(.3);},onComplete:function(request){RefreshComment(linkid); Element.show('approver'); window.setTimeout("Element.hide('approver')",6000);},
  method: 'post',
  parameters: {sub_com: '1', comment: $F(comment),linkid: linkid}
  });
}

function Faded(k){
$('pic'+k).setOpacity(0.3);
}
function Bright(k){
$('pic'+k).setOpacity(1);
}
function ChangePic(id,total){
var i;
for(i = 1; i <= total; i++){
if(i != id){
   Element.hide('bpic'+i);
   $('pic'+i).setOpacity(0.3);
   $('pic'+i).writeAttribute('onmouseout','Faded('+i+');');
   $('pic'+i).writeAttribute('onmouseover','Bright('+i+');');
   }
   else {
   Element.show('bpic'+i);
   $('pic'+i).setOpacity(1);
   $('pic'+i).writeAttribute('onmouseout','');
   $('pic'+i).writeAttribute('onmouseover','');
   }
}
}
function GoAddFavorite(linkid){
	$('main_body').setOpacity(0.3);
	$('main_header').setOpacity(0.3);
	$('bottom_body').setOpacity(0.3);
	Element.show('fav');
	new Ajax.Updater('fbox', 'http://www.recipekey.com/actions/addfavorite.php?link='+linkid+'&b=0',{onLoading:function(request){}, onComplete:function(request){}, asynchronous:true, evalScripts:true});
}
function GoCloseFavorite(i){
	$('main_body').setOpacity(1);
	$('main_header').setOpacity(1);
	$('bottom_body').setOpacity(1);
	Element.hide('fav');
}

function GoAddGrocery(linkid){
	$('main_body').setOpacity(0.3);
	$('main_header').setOpacity(0.3);
	$('bottom_body').setOpacity(0.3);
	Element.show('groc');
	new Ajax.Updater('gbox', 'http://www.recipekey.com/actions/addgrocery.php?link='+linkid+'&b=0',{onLoading:function(request){}, onComplete:function(request){}, asynchronous:true, evalScripts:true});

}
function GoCloseGrocery(i){
	$('main_body').setOpacity(1);
	$('main_header').setOpacity(1);
	$('bottom_body').setOpacity(1);
	Element.hide('groc');
}
function GoChangeLabel(id,linkid,label){
new Ajax.Updater('clabel'+id, 'http://www.recipekey.com/actions/addfavorite.php?fout=1&id='+id+'&linkid='+linkid+'&lb='+label,{onLoading:function(request){},onComplete:function(request){},asynchronous:true, evalScripts:true});	
}
function AddMenu(linkid){
	//$('main_body').setOpacity(0.3);
	//$('main_header').setOpacity(0.3);
	//$('bottom_body').setOpacity(0.3);
	Element.show('addmenu');
	new Ajax.Updater('mbox', 'http://www.recipekey.com/actions/addmenu.php?link='+linkid+'&b=0',{onLoading:function(request){}, onComplete:function(request){}, asynchronous:true, evalScripts:true});
}
function GoCloseMenu(i){
	//$('main_body').setOpacity(1);
	//$('main_header').setOpacity(1);
	//$('bottom_body').setOpacity(1);
	Element.hide('addmenu');
}
function AddMenuInfo(){
var form = $('menuform');
var dateField = form['dateField'];
var optionmenu = form['optionmenu1'];
//var buttons = form.getInputs('radio', 'menuform');
//alert(buttons.length);

var mealtype = form['mealtype'];
var recipelink = form['recipelink'];
//alert($F(optionmenu));

//alert($F(dateField));
//var state = form['state'];
//var country = form['country'];
//var experience = form['experience'];
//var favdishes = form['favdishes'];
//var cookexp = form['cookexp'];
if($F(optionmenu) == 1) new Ajax.Updater('mbox', 'http://www.recipekey.com/actions/addmenu.php', {onLoading:function(request){},onComplete:function(request){},method: 'post', parameters: {dateField: 0,mealtype:0,recipelink:$F(recipelink) },asynchronous:true, evalScripts:true});
else new Ajax.Updater('mbox', 'http://www.recipekey.com/actions/addmenu.php', {onLoading:function(request){},onComplete:function(request){},method: 'post', parameters: {dateField: $F(dateField),mealtype:$F(mealtype),recipelink:$F(recipelink) },asynchronous:true, evalScripts:true});
	//Element.show('editprofile');
}
function ShowWeekly(){
		$('main_body').setOpacity(0.3);
	$('main_header').setOpacity(0.3);
	$('bottom_body').setOpacity(0.3);
	Element.show('WeeklySpecials');
}
function CloseWeekly(){
		$('main_body').setOpacity(1);
	$('main_header').setOpacity(1);
	$('bottom_body').setOpacity(1);
	Element.hide('WeeklySpecials');
}