<!--
self.moveTo(0,0);
self.resizeTo(screen.availWidth,screen.availHeight);

jQuery.noConflict();
(function($){
    $(function(){
        // reset button in the search form
        $('#zoek-form .reset').click(function(){
            var form = $('#zoek-form');
            form.find('input:checkbox').removeAttr('checked');
            form.find('input[name="search[nickname]"]').val('');
            form.find('input[name="search_category[female]"]').attr('checked','checked');
            form.find('input[name="search_category[couple]"]').attr('checked','checked');
            form.find('select').val('all');
            setCookie('search-options','',0);
            $('#zoek-form').submit();
        });
        // click to collapse or fold search options
        $('#zoek-form ul.buttons .options').click(function(){
            var btn = $(this);
            if ( btn.hasClass('back') )
            {
                $('#zoek-form .reset').fadeOut('slow');
                $('#zoek-form .second-row').slideUp('slow');
                $('input[name="view-ext"]').val(0);
                setCookie('view-ext',0, 7);
                btn.toggleClass('back');
            }
            else
            {
                $('#zoek-form .second-row').slideDown('slow');
                $('#zoek-form .reset').fadeIn('slow');
                $('input[name="view-ext"]').val(1);
                setCookie('view-ext',1, 7);
                btn.toggleClass('back');
            }
        })

        if ( parseInt(getCookie('view-ext')) ){ 
            $('#zoek-form ul.buttons .options').addClass('back');
            $('#zoek-form .second-row').show();
            $('#zoek-form .reset').fadeIn('slow');    
        }
        
        if ( parseInt($('input[name="view-ext"]').val()) )
        {
            $('#zoek-form .second-row').show();
            $('#zoek-form ul.buttons .options').addClass('back');
        }
        
        $('#zoek-form input[type="checkbox"]').click(function(){
            var form = $('#zoek-form');
            setCookie('search-options',form.serialize(),7);
            form.submit();
            return false;
        });
        
        $('#zoek-form select').change(function(){
            var form = $('#zoek-form');
            setCookie('search-options',form.serialize(),7);
            $('#zoek-form').submit();
            return false;
        });
        
        $('.del-lastvisit a').click(function(){setCookie('lastvisited','',0);});
    /*    
        $('.cam-item').each(function(){
            var item = $(this);
            $('<div id=\"vid-'+item.attr('id').substr(7)+'\" class=\"video-preview '+item.find('img').attr('class')+'\"></div><div class=\"blank\"></div>').appendTo(item);    
        });
     */   
        // live preview for 5 sec
        $('a.cam-item').live('mouseover',  
            function(){
                var camItem = $(this);
                if(camItem.data('hover') == undefined || !camItem.data('hover'))
                {
                    camItem.data('hover',1);
                    var camId = camItem.attr('id').substr(7);
                    var videoPreview = camItem.find('.video-preview');
                    var img = camItem.find('img');
                    var blank = camItem.find('.blank');
                    $('<div/>',{'id':'pl-'+camId}).appendTo(videoPreview);
                    blank.css({'width':img.width(),'height':img.height()});
                    startCamPlayer('pl-'+camId, camId, img.width(), img.height());
                }
                return false;
            }
        ).live('mouseleave',function(){
                var camItem = $(this);
                camItem.data('hover',0);
                var camId = camItem.attr('id').substr(7);
                var videoPreview = camItem.find('.video-preview');
                videoPreview.html('');
                return false;
        });
        
        // event on search nickname change
        $('input[name="search[nickname]"]').change(function(){
            setCookie('search_nickname', $(this).val(), 7);
        });
    })   
    
})(jQuery)

function delElement(elementId)
{
  element = document.getElementById(elementId);
  if (element) {
    element.parentNode.removeChild(element);
  }
}

function element(id){
	return document.getElementById ? document.getElementById(id) : document.all[id];
}

function refreshCams() {
	xajax_refreshcams();
	setTimeout('refreshcams()', 60000);
}

function maxWindow(url, name, width, height) {
  features = 'scrollbars=1,resizable=1,menubar=0,toolbar=0,location=0,status=0,top=0,left=0,screenX=0,screenY=0,';

  if (window.screen) {
    aw = screen.availWidth;
    ah = screen.availHeight;
    features = features+'width='+(aw-20)+',height='+(ah-38);
  }
  else {
    features = features+'width='+width+',height='+height;
  }
  window.open(url, name, features);
}
  
function popupWindow(url, w, h) {
  var middleLeft = 400 - w;
  var middleTop = 10;
	        
  if (window.screen) {
    middleLeft = (screen.availWidth / 2) - (w / 2);
  }
			          
  window.open(url, '', 'scrollbars=0,resizable=0,menubar=0,toolbar=0,location=0,status=0,top='+middleTop+',left='+middleLeft+',width='+w+',height='+h);
}
  
function openNewWindow(URLtoOpen, windowName, windowFeatures) { 
  newWindow=window.open(URLtoOpen, windowName, windowFeatures);
}

function addBookmark(title,url) {
	if (window.sidebar) { 
		window.sidebar.addPanel(title, url,""); 
	} else if( document.all ) {
		window.external.AddFavorite( url, title);
	} else if( window.opera && window.print ) {
	return true;
	}
}

function checkItem(id)
{
	if(element(id).className == 'actlink')
	{
		
		element(id).className = 'unactlink';
		
		//element(id).style.fontWeight = 'normal';
		//element(id).style.color = '#000000';
	}
	else
	{
		element(id).className = 'actlink';
		
		//element(id).style.fontWeight = 'bold';
		//element(id).style.color = '#0ea8d4';
	}
	
	xajax_filter(id, '1');
}

var img_cache = new Object();

function parse_images() {
	if (document.getElementById) {
		var ar = document.getElementsByTagName('img');
		for( var x = 0; ar[x]; x++ ) {
			var im = ar[x];
			if(im.getAttribute) {
				im.hoversrc = im.getAttribute('hoversrc');
			}
			if(im.hoversrc) {
				im.rootsrc = im.src;
				im.onmouseout = function () {
					this.className = '';
					this.src = this.rootsrc;
				}
				im.onmouseover = function () {
					this.className = this.hoversrc;
				}
			}
		}
	}
}

function OpenBlock() {
	document.getElementById('fo').style.display = 'block';
	document.getElementById('fc').style.display = 'none';
}
function CloseBlock() {
	document.getElementById('fo').style.display = 'none';
	document.getElementById('fc').style.display = 'block';
}

/**
*   Video preview   
**/
function startCamPlayer( selector, camid, width, height )
{
    // Config
    var player = "http://cams.dnxlive.com/swf/live_preview_public.swf";
    var defaultWidth  = 160;
    var defaultHeight = 120;
    
    // Init 
    width  = typeof(width)=='undefined' ? defaultWidth : width;
    height = typeof(height)=='undefined' ? defaultHeight : height;

    swfobject.embedSWF(
        player,
        selector,
        width,
        height,
        '9.0.0',
        'expressInstall.swf',
        {
            // Flashvars
            account: camid
        },
        {
            //Params
            wmode: "transparent", 
            allowScriptAccess: "always"
        },
        {
            /*
            id:'player',
            name:'player'
            */
        }
    );
}

/**
* Cookies
**/
var _cookies;
function _initCookies() {
  _cookies = {};
  var ca = document.cookie.split(';');
  var re = /^[\s]*([^\s]+?)$/i;
  for(var i = 0; i < ca.length; i++) {
    var c = ca[i].split("=");
    if(c.length == 2) {
     _cookies[c[0].match(re)[1]] = unescape(c[1].match(re) ? c[1].match(re)[1] : '');
    }
  }
}

function getCookie(name) {
  if(!_cookies) _initCookies();
  return _cookies[name];
}

function setCookie(name, value, days) {
  if(!_cookies) _initCookies();
  _cookies[name] = value;
  if (days) {
    var date = new Date();
    date.setTime(date.getTime()+(days*24*60*60*1000));
    var expires = "; expires="+date.toGMTString();
  }
  else var expires = "";
  path = path ? path : '/';
  var domain = location.host.match(/[^.]+\.[^.]+$/);
  document.cookie = name+"="+escape(value)+expires+"; path=" + path + (domain ? '; domain=.'+domain : ';');
}

//-->


