﻿// JScript File
// All anchors MUST be root.absolute, because of <BASE> for postindex

// Global variables
var vs,vf;
var spotID = 0;
var xMousePos = 0;
var yMousePos = 0;
var spotMenuShowing = false;
var timerRunning = false;
var timerID = null;
var spotmenuLayer = document.getElementById("spotmenu");

function sort(st)
{
	document.getElementById("qsort").value=st
	var d=document.forms[0]  
	d.method='get'
	d.submit()
}

function postmail()
{
	var d=document.forms[0]    //getElementById("aspnetForm")
	d.method='post'
    d.action='/public/profreg.aspx'
	d.submit()
}


// Capture mouse-positions
if (document.all)
{	// IE
	document.onmousemove = captureMousePosition;
} 
else if (document.getElementById) 
{	// Netscape 6
	document.onmousemove = captureMousePosition;
}

function showSpotMenu(sid) {

  if (sid!=spotID){
    spotID=sid;
    spotmenuLayer.style.left=(xMousePos + 22)+'px';
    spotmenuLayer.style.top=(yMousePos + 1)+'px';
  }
  if(spotMenuShowing) {
    stopTimer();
  } else {
    spotmenuLayer.style.left=(xMousePos + 22)+'px';
    spotmenuLayer.style.top=(yMousePos + 1)+'px';
    spotmenuLayer.style.visibility='visible';
    spotMenuShowing = true;
  }
}

function captureMousePosition(e) {
    if (!e) var e=window.event;

    if (e.pageX || e.pageY)
    {
        xMousePos = e.pageX;
        yMousePos = e.pageY;
    }
    else if (e.clientX || e.clientY)
    {
        xMousePos = e.clientX+document.body.scrollLeft+document.documentElement.scrollLeft;
        yMousePos = e.clientY+document.body.scrollTop+document.documentElement.scrollTop;
    }
}

function stopTimer() {
  if(timerRunning) {
    clearTimeout(timerID);
  }
  timerRunning = false;
}

function timerDone() {
  timerRunning = false;
  spotmenuLayer.style.visibility='hidden';
  spotMenuShowing = false;
}

function startTimer() {
  stopTimer();
  timerRunning = true
  timerID = self.setTimeout("timerDone()", 500)	
}

function setOverSpotMenu() {stopTimer();}
function setOutSpotMenu() {startTimer();}
function hideSpotMenu() {startTimer();}
function overRow(tr) {tr.style.backgroundColor = "#ffd700";}
function outRow(tr) {tr.style.backgroundColor = "#c8ccbe";}

function spotLoc(){
	var ur='/public/spotLoc.aspx?pi='+spotID
	spotVenLarge(ur)
}
function spotMylistAdd(){
	var ur='/public/spotMylistadd.aspx?pi='+spotID
	spotVenSmall(ur)
}
function spotMylistDel(){
	if (confirm('Weet u zeker dat u deze vacature wilt verwijderen?'))
		document.location.href='/user/userTabticket.aspx?act=del&pi='+spotID
}
function spotSafven(){
    var ur='/public/spotSafven.aspx?pi='+ spotID
	spotVenSmall(ur)
}

function spot(postObject,si,target,mode) 
{ 
	myurl = postObject.getAttribute('href')

	if (target == undefined) target = '_blank'
	var  options = 'left=' + Math.ceil((screen.width-800)/2) + ',top=' + Math.ceil((screen.height-600)/2) + ',width=800,height=600'
	if (mode == "prompt")  options += ",status=no,toolbar=no,menubar=no,location=no,resizable=no,scrollbars=no,directories=no"
	else if (mode == "browse")  options += ",status=no,toolbar=no,menubar=no,location=no,resizable=no,scrollbars=yes,directories=no"
	else options += ",status=yes,toolbar=yes,menubar=yes,location=yes,resizable=yes,scrollbars=yes,directories=yes"
    win = window.open(myurl,target,options); 
    
    pageTracker._trackPageview("/outgoing/shop"+si);
    try { win.focus(); } catch(e) { };  return false; 
} 

function spotVenSmall(ur){
	if(!vs||vs.closed){
		vs=window.open(ur,'jsaf','top=100,left=100,height=326,width=500,toolbar=0,location=0,status=0,menubar=0,scrollbars=0,resizable=1')
	}
	else{
		vs.focus()
		vs.location=ur
	}
}

function spotVenLarge(ur){
	if(!vs||vs.closed){
		vs=window.open(ur,'jsaf','top=100,left=100,height=500,width=500,toolbar=0,location=0,status=0,menubar=0,scrollbars=0,resizable=1')
	}
	else{
		vs.focus()
		vs.location=ur
	}
}
