
var gateway = "http://cams.dnxlive.com/webservices/gateway.php";
function getFavorites() {
$.getJSON(gateway + "?task=getAllPreferences&scope=favorites&jsoncallback=?",
function(data) {
if($.isArray(data.favorites)) {
	$.getJSON("/getfavorites.php?favorites=" + data.favorites,
	function(data) {
		$("#getfavorites").html(data.html);	
        /*$("a.fancyfavorite").fancybox({
                'autoDimensions':       false,
                'transitionIn'  :       'none',
                'transitionOut' :       'none',
                'padding'       :       0,
                'width'                 :       839,
                'height'                :       480,
                'overlayShow'   :       false,
                'type'  : 'iframe',
                'scrolling'     :       'no',
                'hideOnContentClick' : false
        });*/
		
	});
}
});
}
function addToFavorites(account) {
$.getJSON(gateway + "?task=addToFavorites&account=" + account + "&jsoncallback=?",
function(data) {
getFavorites();
});
}
function removeFromFavorites(account) {
$.getJSON(gateway + "?task=removeFromFavorites&account=" + account +
"&jsoncallback=?", function(data) {
getFavorites();
});
}

function show3d() {

	if( $('#3Dcontent').css('display') == 'none')  {
		$('#3Dcontent').css('display','block');
		$('#Zapbar_SnapSize.3D').css('display','block');
		document['threedbutton'].src = '/v2/Images/closeExtras.png';
		createCookie('3d','OK',30);
	} else {
		$('#3Dcontent').css('display','none');
		$('#Zapbar_SnapSize.3D').css('display','none');
		document['threedbutton'].src = '/v2/Images/openExtras.png';
		eraseCookie('3d');
	}
}

function popupFull(url)
{
//if(screen.width < 900) {
        width = screen.width;
//} else {
//        width = 900;
//}
 params  = 'width=' + width;
 params += ', height='+screen.height;
 params += ', top=0, left=0'
 params += ', fullscreen=yes';
 params += ', resizable=yes';
 params += ', scrollbars=yes';

 newwin=window.open(url,'windowname4', params);
 if (window.focus) {newwin.focus()}
 return false;
}

function popupSmall(url)
{
 params  = 'width=716';
 params += ', height=400';
 params += ', top=0, left=0'
 params += ', fullscreen=no';
 params += ', resizable=no';
 params += ', scrollbars=yes';

 newwin=window.open(url,'windowname4', params);
 if (window.focus) {newwin.focus()}
 return false;
}


                        function toggleLangs() {
                                if( $('#langBlock').css('display') == 'none')  {
                                        $('#langBlock').css('display','block');
                                } else {
                                        $('#langBlock').css('display','none');
                                }
                        }


function BookMark() {
 var BookmarkURL = "http://www.sexpression.be";
 var BookmarkTitle = "Sexpression.be | Live 18+ Webcamshows";

if (document.all) {
	window.external.AddFavorite(BookmarkURL,BookmarkTitle)
} else {
	window.sidebar.addPanel(BookmarkTitle, BookmarkURL, '');
}
}



function createCookie(name,value,days) {
	if (days) {
		var date = new Date();
		date.setTime(date.getTime()+(days*24*60*60*1000));
		var expires = "; expires="+date.toGMTString();
	}
	else var expires = "";
	document.cookie = name+"="+value+expires+"; path=/";
}

function readCookie(name) {
	var nameEQ = name + "=";
	var ca = document.cookie.split(';');
	for(var i=0;i < ca.length;i++) {
		var c = ca[i];
		while (c.charAt(0)==' ') c = c.substring(1,c.length);
		if (c.indexOf(nameEQ) == 0) return c.substring(nameEQ.length,c.length);
	}
	return null;
}

function eraseCookie(name) {
	createCookie(name,"",-1);
}


function timedRefresh(timeoutPeriod) {
	setTimeout("location.reload(true);",timeoutPeriod);
}

function swapimage(mini_name) {                                                
	mainsrc = document['main'].src;
        minisrc = document[mini_name].src;
        document['main'].src = minisrc; 
	document[mini_name].src = mainsrc;                                
	
}

function toggleSearch() {
	var height = $('.search').height();
	if(height == 120) {
		$('.search').height(250);
		$('.extrawrapper').css({visibility: "visible"});
		$('.showbutton').css({visibility: "hidden"});
		$('.hidebutton').css({visibility: "visible"});
		createCookie('searchopen','Y',10);	
	} else {
		$('.search').height(120);
		$('.extrawrapper').css({visibility: "hidden"});
                $('.showbutton').css({visibility: "visible"});
                $('.hidebutton').css({visibility: "hidden"});
		eraseCookie('searchopen');
	}
}



