﻿var pageLoaded=false;
var vidClicked=false;
var info;
var sms;

function showFoto2009(pic, loc){
    info = document.getElementById('infopopup2009');
	x=0;
	y=0;
	if(loc%5<3)
	    x = ((loc%5)*120+170)+'px';
	else
	    x = ((loc%5)*120-200)+'px';

	if(Math.floor(loc/5)<2)
		y = ((Math.floor(loc/5)*120)+170)+'px';
	else
		y = ((Math.floor(loc/5)*120)+100)+'px';

	info.style.top=y;
	info.style.left=x;
    info.innerHTML='<img id="overview_popup_pic" src="'+pic+'" alt="" style="border: 2px white solid" />';
    document.getElementById('overview_popup_pic').onload=showPic2009;
    showPic2009();
}
function showPic2009(){
    info = document.getElementById('infopopup2009');
    info.style.visibility='visible';
    info.style.display='block';
}

function hidePic2009(){
    info = document.getElementById('infopopup2009');
    info.style.visibility='hidden';
	info.style.display='none';
}

function showFotoHome(pic, loc, alias, firstname){
    info = document.getElementById('infopopup');
    sms = document.getElementById('sms');
    
    info.style.left = 0;
	x = info.offsetWidth;
	y = sms.offsetTop;
    y = y + ((Math.floor(loc/2)*80));
    
	loc = loc+1;
	if(loc%2==0)
	    x = x - 100 ;
	else
	    x = x + 120;

	info.style.top = y + 'px';
	info.style.left= x + 'px';
    info.innerHTML='<div class="meisjes_popup"><img id="overview_popup_pic" src="'+pic+'" alt="" /><p class="thumb_caption">' + firstname + '</p><img src="/images/sms_popup.jpg" align="left" class="mr6" /><span class="sms_caption">SMS <span class="blacktext">&#39;BM ' + alias + '&#39;</span><br/>naar 2211. </span><br/><span class="smaller">&euro; 0,90 P.O.B.</span></div>';
    document.getElementById('overview_popup_pic').onload=showPic;
    showPic();
}

function showFoto(pic, loc, alias, firstname, status){
    info = document.getElementById('infopopup');
	x=0;
	y=0;
	if(loc%5<3)
	    x = ((loc%5)*120+170)+'px';
	else
	    x = ((loc%5)*120-200)+'px';

	if(Math.floor(loc/5)<2)
		y = ((Math.floor(loc/5)*120)+170)+'px';
	else
		y = ((Math.floor(loc/5)*120)+100)+'px';

	info.style.top=y;
	info.style.left=x;

    var smstext = ((status==20) ? '<img src="/images/sms_popup.jpg" align="left" class="mr6" /><span class="sms_caption">SMS <span class="blacktext">&#39;BM ' + alias + '&#39;</span><br/>naar 2211. </span><br/><span class="smaller">&euro; 0,90 P.O.B.</span>' : '');
    info.innerHTML='<div class="meisjes_popup"><img id="overview_popup_pic" src="'+pic+'" alt="" /><p class="thumb_caption">' + firstname + '</p>' + smstext + '</div>';
    document.getElementById('overview_popup_pic').onload=showPic;
    showPic();
}

function showPic(){
    info = document.getElementById('infopopup');
    info.style.visibility='visible';
    info.style.display='block';
}

function hidePic(){
    info = document.getElementById('infopopup');
    info.style.visibility='hidden';
	info.style.display='none';
}

//Get cookie routine by Shelley Powers 
function get_cookie(Name) {
  var search = Name + "="
  var returnvalue = "";
  if (document.cookie.length > 0) {
    offset = document.cookie.indexOf(search)
    // if cookie exists
    if (offset != -1) { 
      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 previewFoto(pic){
    info = document.getElementById('fotopopup');
    info.innerHTML='<img id="overview_popup" src="'+pic+'" alt="" />';

    showPreview();
    SetHeightAndWidth();
    document.getElementById('overview_popup').onload=SetHeightAndWidth;
}

function SetHeightAndWidth(){
    var img = document.getElementById('overview_popup')
    var arrayPageSize = getPageSize();
    var arrayPageScroll = document.viewport.getScrollOffsets();
    var x = arrayPageScroll[1] + (document.viewport.getHeight() / 20);
    var y = document.viewport.getWidth()/2 - img.width/2 ;
    
    info.style.top= x + 'px' ;
    info.style.left=y + 'px' ;
}

function showPreview(){
    info = document.getElementById('fotopopup');
    info.style.visibility='visible';
	info.style.display='block';
}

function hidePreview(){
    info = document.getElementById('fotopopup');
    info.style.visibility='hidden';
	info.style.display='none';
}

//
//  getPageSize()
//
function getPageSize(){
        
    var xScroll, yScroll;
	
	if (window.innerHeight && window.scrollMaxY) {	
		xScroll = window.innerWidth + window.scrollMaxX;
		yScroll = window.innerHeight + window.scrollMaxY;
	} else if (document.body.scrollHeight > document.body.offsetHeight){ // all but Explorer Mac
		xScroll = document.body.scrollWidth;
		yScroll = document.body.scrollHeight;
	} else { // Explorer Mac...would also work in Explorer 6 Strict, Mozilla and Safari
		xScroll = document.body.offsetWidth;
		yScroll = document.body.offsetHeight;
	}
	
	var windowWidth, windowHeight;
	
	if (self.innerHeight) {	// all except Explorer
		if(document.documentElement.clientWidth)
			windowWidth = document.documentElement.clientWidth; 
		else 
			windowWidth = self.innerWidth;
		windowHeight = self.innerHeight;
	} else if (document.documentElement && document.documentElement.clientHeight) { // Explorer 6 Strict Mode
		windowWidth = document.documentElement.clientWidth;
		windowHeight = document.documentElement.clientHeight;
	} else if (document.body) { // other Explorers
		windowWidth = document.body.clientWidth;
		windowHeight = document.body.clientHeight;
	}	
	
	// for small pages with total height less then height of the viewport
	if(yScroll < windowHeight)
		pageHeight = windowHeight;
	else 
		pageHeight = yScroll;

	// for small pages with total width less then width of the viewport
	if(xScroll < windowWidth)
		pageWidth = xScroll;		
	 else 
		pageWidth = windowWidth;

	return [pageWidth,pageHeight];
}

var sURL
function onRefreshPage(url, delay) {sURL=url; setTimeout( "refresh()", delay);}
function refresh() { window.location.href = sURL; }

function showUitleg(){
    info = document.getElementById('uitleg');
    info.style.display='block';
}

function hideUitleg(){
    info = document.getElementById('uitleg');
	info.style.display='none';
}






