/**
  Java script file for GM travel
**/

/********* pop up sized window for updating offers ************/


/*
global var pup = _gel("paket_resor");
var ie = document.all ? true : false;

var pupActive = false;
var mouseX = 0;
var mouseY = 0;
document.onmousemove=get_mouse;
function _gel(id){return document.getElementById(id); }

*/

function pop_up( location , width , height, scrollvar)
	{		
		if (scrollvar == null)
		{
		scrollvar = "scrollbars=no";
		}
	
		if (scrollvar == "yes")
		{
			scrollvar = "scrollbars=yes";
	
			if (document.all)
			{
				//width = width + 15;
				height = height + 16;
			}
		}
		
		if (scrollvar == "no")
		{
			scrollvar = "scrollbars=no";
		}

  
  	
  	/*
    document.forms['addForm0'].destination.value = "kemo";
  	document.forms['addForm'].price.value = 'yyy';
    document.forms['addForm'].info.value =  'zzzz';
    document.forms['addForm'].onFirstPage.value = 'oooo';
    */
    ev = eval("'status=no,location=no,menubar=no,toolbar=no,resizable=yes," + scrollvar + ",width=" + width + ",height=" + height + "'");
		updateW = window.open( location , 'pop_up_window' ,ev );
		
/*		updateW.moveTo(550,450); */

	}

function  offerFormClose(){
  
  window.opener.location.href = "offers.php?placeOffer=Skicka";
  window.close();
}


function  packageFormClose(){
  window.opener.location.href = "packages.php?placeOffer=list";
  window.close();
}

function  confirmDelete( ID ){

    var name=confirm("Vill du säkert ta bort?" );

    if (name==true)
    {
      window.opener.location.href = "offers.php?ID=" + ID;
/*
      <?
        header("Refresh: 0; url=http://localhost/mlv/offers.php?ID=5");
      ?>
*/

        
    }
      else
    {
      window.opener.location.href = "offers.php?placeOffer=Skicka";
    }

}

function change(id, newClass) {

identity=document.getElementById(id);

identity.className=newClass;

}

function redirect( id ){
    window.location.href = "http://www.gmtravel.se/gm_mysql_version/erbjudanden/detaljeraterbjudand.php?ID=" + id;
  
}

/*


// set dynamic coords
function get_mouse(e){
	
	mouseX = ie ? event.clientX : e["clientX"];
	mouseY = ie ? event.clientY : e["clientY"]; 

	renderPopup();

}

function renderPopup(){
	
	x = mouseX;
	y = mouseY;
	
	scrollX = document.body.scrollLeft;
	scrollY = document.body.scrollTop;

	pup.style.left = (x+scrollX+40)+"px";
	pup.style.top = (y+scrollY+20)+"px";

	heightExtreem = document.body.clientHeight + scrollY - pup.offsetHeight;
	if(parseInt(pup.style.top) > heightExtreem){
		pup.style.top = heightExtreem+"px";
	}
	widthExtreem = document.body.clientWidth + scrollX - pup.offsetWidth;
	if(parseInt(pup.style.left) > widthExtreem){
		
		pup.style.left = widthExtreem+"px";
	}
	
	if(pupActive && ie){
		w = pup.offsetWidth;
		h = pup.offsetHeight;
		x = parseInt(pup.style.left)-scrollX;
		y = parseInt(pup.style.top)-scrollY;
		arr = new Array("SELECT", "IFRAME");
		for(j=0;j<arr.length;j++){
		for (i = 0; i < document.all.tags(arr[j]).length; ++i){
			obj = document.all.tags(arr[j])[i];
			o = FindXYWH(obj);
			if ( (o.x > (x + w) || (o.x + o.w) < x) || (o.y > (y + h) || (o.y + o.h) < y) ){
				obj.style.visibility = "visible";
			}else{
				obj.style.visibility = "hidden";
			}
		}
		}
	}
}

function popup(str){
	if(zBuffMode){return;}
	pupActive = true;
	if(GetCookie("popups") == 0){return;}
	pup.style.display = "block";
	pup.innerHTML = "<table cellspacing=0 cellpadding=0 bgcolor='#ffffff'><tr><td width=12><img src='bild/shop_tl.gif'></td><td background='bild/shop_t.gif'><img src='s.gif'></td><td width=13><img src='bild/shop_tr.gif'></td></tr><tr><td background='bild/shop_l.gif'><img src='s.gif'></td><td width=300>"+str+"</td><td background='bild/shop_r.gif'><img src='s.gif'></td></tr><tr><td width=12><img src='bild/shop_bl.gif'></td><td background='bild/shop_b.gif'><img src='s.gif'></td><td width=13><img src='bild/shop_br.gif'></td></tr></table>";
	pup.style.width = pup.offsetWidth;
}
function kill(){
	pupActive = false;
	pup.style.display = "none";
	pup.style.width = "auto";
	if(ie){showSel();}
}

function showSel(){
	arr = new Array("SELECT", "IFRAME");
	for(j=0;j<arr.length;j++){
	for (i = 0; i < document.all.tags(arr[j]).length; ++i){
		var obj = document.all.tags(arr[j])[i].style.visibility = "visible";
	}
	}
}


function FindXY(obj){
	var x=0,y=0;
	while (obj!=null){
		x+=obj.offsetLeft-obj.scrollLeft;
		y+=obj.offsetTop-obj.scrollTop;
		obj=obj.offsetParent;
	}
	return {x:x,y:y};
}

function FindXYWH(obj){
	var objXY = FindXY(obj);
	return objXY?{ x:objXY.x, y:objXY.y, w:obj.offsetWidth, h:obj.offsetHeight }:{ x:0, y:0, w:0, h:0 };
}

*/