var txtLocals = {
  subscription : "Nieuwop Pornocams.nl Volg je favoriete dames.<br />- Ontvang updates van <b>%s</b> <br />- Weet wanneer <b>%s</b> online <br />- Nog veel meer ... <br /><br />Natuurlijk is uitschrijven op elk moment mogelijk !"
}

$(function(){
   // play clips
        var tm = null;
        $('.clip').hover(
            function(){
              var img = $(this).find('img');
              tm = setInterval(function(){
                 var n = /_(.{2})\.[^.]+$/g.exec(img.attr('src'));
                 if (typeof n == 'object') {
                    n = parseInt(n[1],10);
                    n = n >= 10 ? 1 : ++n;
                    n = n == 10 ? '10' : ('0' + n);
                    img.attr('src', img.attr('src').replace(/_(.{2})\.([^.]+)$/, '_'+n+'.$2'));
                 }
                },600);
            },
            function(){
                !tm || clearInterval(tm);
            }
        );

        new Dialog({'name':'subscribe'}, function(){
     	   var form = $(this);
                   $.post('subscription.php', form.serialize(), function(data){
		if (data.error == undefined) {
                                        var parent = form.hide().parent();
                                        var close = parent.parent().find('.close').hide();
                                        var result = $('<p/>',{'css':{'line-height':'20px','font-size':'14px','color':'#ccc'}}).html(data.result).appendTo(parent);
		        $('<button/>',{'css':{'width':'80px','padding':'8px 0','display':'block','margin':'10px auto'}}).text('Close').appendTo(result).click(function(){
                                        	result.remove();
			close.click();
			form.show();
                                        });
                                } else {
                                        alert(data.error);
                                }
                   }, 'json');
                   //form.parents('.dialog').find('.close').click();
     	   return false;
        }).launcher('.subscribe', function(dlg){
     	   var link = $(this);
     	   var formcontent = dlg.find('.formcontent').empty();
                   $('<input/>',{'type':'hidden','name':'camid','value':link.attr('id').split('-')[1]}).appendTo(formcontent);
     	   $('<p/>',{'css':{'font-size':'18px','text-align':'center'}}).text(link.attr('title')).appendTo(formcontent);
           var snapshot = link.parents('.campreview').find('.snapshot');
           if (snapshot.length){
                $('<p/>',{'css':{'text-align':'center'}}).html('<img width="160" src="'+snapshot.attr('src')+'" />').appendTo(formcontent);
           }
           $('<p/>',{'css':{'padding-left':'15%','font-size':'12px','line-height':'18px'}}).html(txtLocals.subscription.replace(/%s/g, link.attr('href').replace('#',''))).appendTo(formcontent);
           $('<label/>',{'css':{'font-size':'12px','margin-right':'10px','margin-left':'50px'}}).text('Email').appendTo(formcontent);
     	   $('<input/>',{'type':'text', 'name':'email', 'css':{'width':'184px'}}).appendTo(formcontent);
        });
        
        $(window).resize(function(){
            var wnd = $(this);
            $('.dialog').css('left', function(){    
               return ((wnd.width()-$(this).width())/2) + 'px';
            }).css('top', function(){
                return ((wnd.height()-$(this).height())/2) + 'px';
            });
        }).keydown(function(e){
            if (e.which == 27) {
                $('.close').click();
            }
        }).resize();
        
        $('.reload').click(function(){
            $('.captcha').attr('src', _url('/captcha?') + uniq(7));
        })
        
});

<!--

function createSendBox()
{
	if (nicEditor != null && typeof nicEditor == 'function') {
		var dlg = $('<div/>',{'id':'sendbox-dlg', 'css':{'display':'none','padding':0,'width':'400px','overflow':'hidden','position':'absolute','background':'#444','z-index':100,'border':'1px solid #ccc','color':'#ccc'}}).text('X').appendTo($('body'));
		var box = $('<div/>',{'class':'sendbox','css':{'margin':'15px'}}).appendTo(dlg);
		var form = $('<form/>').appendTo(box).submit(function(){
			return false;
		});
		$('<div/>',{'class':'close','css':{'width':'20px','height':'20px','text-align':'center','line-height':'20px','position':'absolute','top':'-8px','right':'-8px','background':'#00f', 'color':'#ccc'}}).appendTo(dlg).click(function(){
			
		});
		$('<p/>',{'class':'stitle','css':{'padding':0,'margin':0}}).appendTo(form);
		var textblock = $('<div/>',{'class':'stext'}).appendTo(form);
		$('<textarea/>',{'id':'n-edit','name':'message','css':{'width':'96%', 'padding':'8px','height':'200px','border':'1px solid #333'}}).appendTo(textblock);
		$('<div/>',{'id':'n-panel'}).appendTo(textblock);
		var p = $('<p/>',{'css':{'clear':'both','padding':0,'margin':0}}).appendTo(form);
		$('<input/>',{'type':'submit','name':'submit','value':'Send'}).appendTo(p);
		/*
		var nc = new nicEditor({iconsPath : 'images/ed-btn.gif',buttonList : ['smiley','bold','italic','underline']});
        nc.setPanel('n-panel');
        nc.addInstance('n-edit');
        */
	}
}


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

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

var Checked_image='images/default/high/checkbox_on.png';
var Unchecked_image='images/default/high/checkbox_off.png';

function ShowCheck(obj){

	if(obj.className=='uncheck')
	{
		obj.className='check';
		obj.src=Checked_image;
	}
	else
	{
		obj.className='uncheck';
		obj.src=Unchecked_image;
	}
	return true;
/*obj.src=(obj.src==Checked_image?Unchecked_image:Checked_image);*/
}

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');
}


/**
*   Video preview
**/
function startPlayer( videoSrc, image, width, height, skin )
{
    // Config
    var root_player_path = "";
    var defaultWidth  = 520;
    var defaultHeight = 360;
    var defaultSkin   = 'snel.swf';

    // Init
    width  = typeof(width)=='undefined' ? defaultWidth : width;
    height = typeof(height)=='undefined' ? defaultHeight : height;
    skin =   typeof(skin)=='undefined' ? defaultSkin : skin;
    image =  typeof(image)=='undefined' ? '' : image;

    swfobject.embedSWF(
        root_player_path + 'player.swf',
        'videoplayer',
        width,
        height,
        '9.0.0',
        null,
        {
            // Flashvars
            skin: root_player_path + skin,
            file: videoSrc,
            image: image,
            autostart: 'false',
            duration: -1
        },
        {
            //Params
            allowfullscreen: 'true',
            allowscriptaccess: 'always'
        },
        {
            id:'player',
            name:'player'
        }
    );
}


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';
}


// CLASSES

var Dialog = function(options, callback){
    this.settings = {
        name        : '',
        submit      : ' Submit ',
        formHtml    : '',
        css         : {
                 'width':'400px',
                 'left': '30%',
                 'top': '25%',
                 'background':'#111',
                 'z-index':100,
                 'border':'1px solid #ccc',
                 'color':'#ccc'
        },
        cssClose   : {
                 'width':'20px',
                 'height':'20px',
                 'line-height':'20px',
                 'top':'-8px',
                 'right':'-8px',
                 'background':'#222',
                 'color':'#ccc',
                 'border':'1px solid #ccc'
        },
        cssWrap   : {
                 'background':'#222'
        },
        cssSubmit : {
                  'width':'80px',
                  'padding': '6px 0',
                  'display':'block',
                  'margin' : '10px auto'
        }
    }
    this.dlg =  null;

    this.settings = $.extend(true, this.settings, options);
    this.construct(callback);
}

Dialog.prototype = {
    construct : function(callback){
         this.dlg  = $('<div/>',{
                'id':this.settings.name+'-dlg',
                'class':'dialog',
                'css':$.extend(true, this.settings.css, {'display':'none','position':'fixed','padding':0})
         }).appendTo($('body'));

         var box  = $('<div/>',{
                'class':this.settings.name+'box',
                'css':$.extend(true, this.settings.cssWrap, {'margin':'15px','padding':'10px'})
         }).appendTo(this.dlg);

         $('<div/>',{
             'class':'close',
             'css':$.extend(true, this.settings.cssClose, {'position':'absolute','text-align':'center','cursor':'pointer','title':'close'})
         }).text('X').appendTo(this.dlg).click(function(){
             $(this).parent().hide();
         });

         var form = $('<form/>').appendTo(box).submit(function(){
            if (typeof callback == 'function') {
                return callback.call(this);
            } else {
                alert('Callback is not defined');
                return false;
            }
         }).html('<div class="formcontent">'+this.settings.formHtml+'</div>');

         $('<input/>',{'type':'submit','name':'submit','value':' '+this.settings.submit+' ', 'css':this.settings.cssSubmit}).appendTo(form);
    },
    form : function(html) {
      this.dlg.find('.formcontent').empty().html(html);
      return this;
    },
    launcher  : function(selector, callback){
    	var self = this;
    	$(selector).click(function(){
    		if (typeof callback == 'function') {
    			callback.call(this, self.dlg);
    		}
    		self.show();
    		return false;
    	});
    	return this;
    },
    show : function(){
        $(window).resize();
        this.dlg.show().find('.close').show().end().find('form').show().siblings().remove();
        return this;
    },
    hide : function(){
        this.dlg.hide();
        return this;
    },
    destroy : function(){
        this.dlg.remove();
        delete this.settings;
        delete this.dlg;
    }
}


//-->

<!--
if (top.frames.length != 0)
{
top.location.href = "http://www.pornocams.nl";
}
//-->
