	$(function() {
	
		var xp = 20;
		var yp = 70;
		var exp_cp = 60;
		var name_cp = 'sub_pop';
		var cp_val = readCookie(name_cp);
		var pop_timeout = 10000;
		
		if( typeof( window.innerWidth ) == 'number' ) {
		    //Non-IE
		    myWidth = window.innerWidth;
		    myHeight = window.innerHeight;
		  } else if( document.documentElement && ( document.documentElement.clientWidth || document.documentElement.clientHeight ) ) {
		    //IE 6+ in 'standards compliant mode'
		    myWidth = document.documentElement.clientWidth;
		    myHeight = document.documentElement.clientHeight;
		  } else if( document.body && ( document.body.clientWidth || document.body.clientHeight ) ) {
		    //IE 4 compatible
		    myWidth = document.body.clientWidth;
		    myHeight = document.body.clientHeight;
		  }
	
		var width = myWidth;
		var left = (width / 2) - 275;

	    if (!cp_val) {
	        $("#sub_pop").css('display', 'block');
	        $("#sub_pop").css('left', left);
	        createCookie(name_cp,1,exp_cp); 
	    }
	    
	    $('#pop_click,#pop_close').click(function() {
			$('#sub_pop').hide();
		});

		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 pcreateCookie(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 preadCookie(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;
}


/**
*
*   Display Full Size
*
*   This function will traverse the class="x" and display the full size of the first image
*   
*   @param class to find
*   @return url of image source
*
*/
function display_full_size() {
	var img = $('ul.filmstrip').find('li.current img').attr('src');
	window.open(img);
}



