
function openFullWindow(theURL) { 
	window.open(theURL);
	return false;
}

  function ok(){
  if (confirm('Obs! Raderingen är oåterkallerlig.\nÄr du säker på att du vill radera länken?')){
  	return true;
  }else{
  	return false;}
  }

	
function chkSearch1(thisObj){
  if((thisObj.search.value=='')||(thisObj.search.value=='Ange sökord här...')){
  	alert('Du måste ange ett sökord!');
  	thisObj.search.focus();
  	return false;
  }
  return true;
}

function chkSearch2(thisObj){
  if((thisObj.search.value=='')||(thisObj.search.value=='Ange recept och/eller ingrediens här...')){
  	alert('Du måste ange ett sökord!');
  	thisObj.search.focus();
  	return false;
  }
  return true;
}

function chkSearch3(thisObj){
  if((thisObj.search.value=='')||(thisObj.search.value=='Sök recept / ingrediens här...')){
  	alert('Du måste ange ett sökord!');
  	thisObj.search.focus();
  	return false;
  }
  return true;
}


function toggleObj(objId) {
	if(document.getElementById(objId)){
		if (document.getElementById(objId).style.display != 'block'){
			document.getElementById(objId).style.display = 'block';
		}else{
			document.getElementById(objId).style.display = 'none';
		}
	}
	return false;
}


function validateComp(thisObj){
  if(thisObj.headline.value==''){
  	alert('Du måste ange en rubrik');
  	thisObj.headline.focus();
  	return false;
  }
  if(thisObj.ingrediens.value==''){
  	alert('Du måste ange ingredienser');
  	thisObj.ingrediens.focus();
  	return false;
  }
  if(thisObj.desc.value==''){
  	alert('Du måste ange en beskrivning');
  	thisObj.desc.focus();
  	return false;
  }
  if(thisObj.uname.value==''){
  	alert('Du måste ange ditt namn');
  	thisObj.uname.focus();
  	return false;
  }
  if(thisObj.email.value==''){
  	alert('Du måste ange din e-postadress');
  	thisObj.email.focus();
  	return false;
  }
	
  uploadFile1 = thisObj.recimg.value;
  ext=uploadFile1.substr(uploadFile1.lastIndexOf(".")).toLowerCase();
  if (ext!=""){
	if (ext!=".jpeg"&&ext!=".jpg") {
		//thisObj.recimg.focus();
		alert("Du kan endast ladda upp .jpg bilder.");
		return false;
	}
  }	
	
  return true;
}



function validateTip(thisObj){
  if(thisObj.fname.value==''){
  	alert('Du måste ange ditt namn!');
  	thisObj.fname.focus();
  	return false;
  }
  if(thisObj.tname.value==''){
  	alert('Du måste din väns namn!');
  	thisObj.tname.focus();
  	return false;
  }
  if(thisObj.temail.value==''){
  	alert('Du måste din väns e-postadress!');
  	thisObj.temail.focus();
  	return false;
  }
  return true;
}

function ok2(){
	if (confirm('Säkert?')){
		return true;
	}else{
		return false;
	}
}

function confirmReport(thisObj){
	if (confirm('Är du säker på att du vill anmäla denna kommentar?')){
		return true;
	}else{
		return false;
	}
}


function openRec(theURL,winName,features) { 
	window.open(theURL,winName,'width=550,height=550,titelbar=1,scrollbars=1,status=0,toolbar=0');
	return false;
}



function openInfo(theURL,winName) { 
	window.open(theURL,winName,'width=800,height=600,titelbar=1,scrollbars=1,status=0,toolbar=0,menubar=1');
	return false;
}



function validateReg(thisObj){
  if(thisObj.nickname.value==''){
  	alert('Du måste döpa din kokbok!');
  	thisObj.nickname.focus();
  	return false;
  }
  if(thisObj.name.value==''){
  	alert('Du måste ange ditt förnamn!');
  	thisObj.name.focus();
  	return false;
  }
  if(thisObj.lastname.value==''){
  	alert('Du måste ange ditt efternamn!');
  	thisObj.lastname.focus();
  	return false;
  }
  if(thisObj.email.value==''){
  	alert('Du måste ange din e-postadress!');
  	thisObj.email.focus();
  	return false;
  }
  if(thisObj.password.value==''){
  	alert('Du måste ange ett lösenord!');
  	thisObj.password.focus();
  	return false;
  }
  if(thisObj.password.value!=thisObj.repassword.value){
  	alert('Lösenorden stämmer inte överens!');
  	thisObj.password.focus();
  	return false;
  }
	
  return true;
}

function validateShop(thisObj){
  if(thisObj.name.value==''){
  	alert('Du måste ange ditt förnamn!');
  	thisObj.name.focus();
  	return false;
  }
  if(thisObj.lastname.value==''){
  	alert('Du måste ange ditt efternamn!');
  	thisObj.lastname.focus();
  	return false;
  }
  if(thisObj.address.value==''){
  	alert('Du måste ange din adress!');
  	thisObj.address.focus();
  	return false;
  }
  if(thisObj.postalcode.value==''){
  	alert('Du måste ange ditt postnummer!');
  	thisObj.postalcode.focus();
  	return false;
  }
  if(thisObj.city.value==''){
  	alert('Du måste ange stad!');
  	thisObj.city.focus();
  	return false;
  }
  if(thisObj.email.value==''){
  	alert('Du måste ange din e-postadress!');
  	thisObj.email.focus();
  	return false;
  }
	
	
	
  if((thisObj.password.value=='')&&(thisObj.createLogin.checked)){
  	alert('Du måste ange ett lösenord!');
  	thisObj.password.focus();
  	return false;
  }
  if(thisObj.password.value!=thisObj.repassword.value){
  	alert('Lösenorden stämmer inte överens!');
  	thisObj.password.focus();
  	return false;
  }
	
  return true;
}

function validateBasket(thisObj){
  if(thisObj.amount.value==''){
  	alert('Du måste ange antal!');
  	thisObj.amount.focus();
  	return false;
  }
	
  if(parseInt(thisObj.amount.value)>parseInt(thisObj.stock.value)){
  	alert('Vi har endast ' +thisObj.stock.value+ ' st i lager.');
		thisObj.amount.value='';
  	thisObj.amount.focus();
  	return false;
  }
	
  return true;
}





