//display value in input field
function dV(obj,val)
{
    var tmp = (obj.value==val) ? '' : (obj.value=='') ? val : obj.value;
    if (tmp != obj.value)
        obj.value = tmp;
}

//generic rollover
function rO(obj,wo){var objRef=(obj.childNodes.length==0)?obj:(obj.firstChild.src!=null)?obj.firstChild:obj.lastChild;if(objRef!=null){objRef.src=(wo==1)?objRef.src.split('_lo.').join('_hi.'):objRef.src.split('_hi.').join('_lo.');}}

 
//ANRI: PopUp welches nur einmalig erscheint
var strHref = window.parent.document.location.href;
var popurls=new Array()
popurls[0]="http://www.migros.ch/DE/home/Seiten/Online-Umfrage.aspx"
popurls[1]="http://www.migros.ch/FR/accueil/Seiten/Sondage_en_ligne.aspx"

function openpopup(popurl){
var winpops=window.open(popurl,"","width=980,height=600,toolbar,location,status,scrollbars,menubar,resizable")
}

function get_cookie(Name) {
  var search = Name + "="
  var returnvalue = "";
  if (document.cookie.length > 0) {
    offset = document.cookie.indexOf(search)
    if (offset != -1) { // if cookie exists
      offset += search.length
      // set index of beginning of value
      end = document.cookie.indexOf(";", offset);
      // set index of end of cookie value
      if (end == -1)
         end = document.cookie.length;
      returnvalue=unescape(document.cookie.substring(offset, end))
      }
   }
  return returnvalue;
}

function loadornotger(){
if (get_cookie('jkpopup')==''){
window.location.replace('http://www.migros.ch/DE/home/Seiten/Tiefstpreise.aspx'); 
document.cookie="jkpopup=yes"
}
}
function loadornotfra(){
if (get_cookie('jkpopup')==''){
window.location.replace('http://www.migros.ch/FR/accueil/Seiten/Petits_prix.aspx'); 
document.cookie="jkpopup=yes"
}
}
function loadornotita(){
if (get_cookie('jkpopup')==''){
window.location.replace('http://www.migros.ch/IT/home/Seiten/I_prezzi_piu_bassi.aspx'); 
document.cookie="jkpopup=yes"
}
}
/*
 if (strHref == "http://www.migros.ch/DE/home/Seiten/Home.aspx")
 	{
		loadornotger()
  	} else if ( strHref == "http://www.migros.ch/FR/accueil/Seiten/Home.aspx" )
	{
		loadornotfra()
  	} else if ( strHref == "http://www.migros.ch/IT/home/Seiten/Home.aspx" )
	{
		loadornotita()
  	} 
*/

// aus-/einklappen der FAQ Einträge
function faq_showElement(elementid)
{
   if (window.document.getElementById(elementid).style.display == "block")
   {
      window.document.getElementById(elementid).style.display = "none";
   }
   else
   {
      window.document.getElementById(elementid).style.display = "block";
   }
}

//Popup-Öffner der ein übergebenes Bild in einem Popup-Window öffnet. Das Window hat dann die Grösse des Bildes.
//implementiert von OR ganiv 14.10.2008
function PrevFoto(img){
  		foto1= new Image();
  		foto1.src=(img);
  		Controlla(img);
	}
	function Controlla(img){
  		if((foto1.width!=0)&&(foto1.height!=0)){
    		viewFoto(img);
  		}
  		else{
    		funzione="Controlla('"+img+"')";
    		intervallo=setTimeout(funzione,20);
  		}
	}
	function viewFoto(img){
  		largh=foto1.width+20;
  		altez=foto1.height+20;
  		stringa="width="+largh+",height="+altez;
  		finestra=window.open(img,"",stringa);
	}

//GANIV
//URL Aufruf aus einem HTML-Select-Element. Benutzt z.B in den HTs Sortiment
//übergeben wird der value aus dem Optiontag. Im value kann mit einem "|_blank" nach dem valuevert angegeben werden 
//ob die URL in einem neuen Fenstzer aufgehen soll
//Beispiel:<option value="www.leshop.ch|_blank">LeShop.ch</option>
function go(wert){
	var auswahl = wert.split("|")[0];
	var newWindow = wert.split("|")[1];
	if(auswahl!="leer"){
		if(newWindow=="_blank"){
			window.open('http://'+auswahl, "gugus", '');
		}else{
			window.location = auswahl;
		}
	}
}
//GANIV 07.09.09
//herausfinden der inneren Breite des Browserwindows
function getInnerWindowSize(){
  		//var myWidth = 0, myHeight = 0;
 		if( typeof( window.innerWidth ) == 'number' ) {
    		//Non-IE
    		layer_breite = window.innerWidth;
    		layer_hoehe = window.innerHeight;
  		} else if( document.documentElement && ( document.documentElement.clientWidth || document.documentElement.clientHeight ) ) {
    		//IE 6+ in 'standards compliant mode'
    		layer_breite = document.documentElement.clientWidth;
    		layer_hoehe = document.documentElement.clientHeight;
  		}
}
