function subscribe() {
	params = '';
	var arrayPageSize = getPageSize();
	width = arrayPageSize[0];
	height = arrayPageSize[1];
	$('dim_background').style.width = width + 'px';
	$('dim_background').style.height = height + 'px';
	$('dim_background').style.display = 'block';
	var arrayWindowSize = getWindowSize();
	width = arrayWindowSize[0];
	height = arrayWindowSize[1];
	$('subscriber_msg').style.left = (width / 2) - 280 + 'px';
	$('subscriber_msg').style.top = (height / 2) - 80 + 'px';
	$('subscriber_msg').style.display = 'block';
	params += $('email_address').serialize();
	params += '&submit=submit';
	new Ajax.Request('/subscribe.html', {
		method: 'post',
		parameters: params,
		onSuccess: function(check) {
				$('subscriber_msg').innerHTML = check.responseText;
		}
	});
}

function close_dim_background() {
	$('dim_background').style.display = 'none';
	$('subscriber_msg').style.display = 'none';
	$('subscriber_msg').innerHTML = '';
}

function toggle_newsletter_field(obj) {
	if(obj.value == 'email') {
		obj.value = '';
	}
}

	
	
	
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];
}
	
function getWindowSize() {
  var myWidth = 0, myHeight = 0;
  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;
  }
  return [myWidth,myHeight];
}

function show_disclaimer() {
	var arrayPageSize = getPageSize();
	width = arrayPageSize[0];
	height = arrayPageSize[1];
	$('dim_background2').style.width = width + 'px';
	$('dim_background2').style.height = height + 'px';
	$('dim_background2').style.display = 'block';
	var arrayWindowSize = getWindowSize();
	width = arrayWindowSize[0];
	height = arrayWindowSize[1];
	$('disclaimer_msg').style.left = (width / 2) - 280 + 'px';
	$('disclaimer_msg').style.top = (height / 2) - 80 + 'px';
	$('disclaimer_msg').style.display = 'block';
}

function enter_site() {
	params = 'submit=1';
	new Ajax.Request('/enter_site.html', {
		method: 'post',
		parameters: params,
		onSuccess: function(check) {
			$('disclaimer_msg').style.display = 'none';
			$('dim_background2').style.display = 'none';
		}
	});
}

function leave_site() {
	window.location.href = "http://www.cartoonnetwork.ro";
}

function hover_disc(obj, which) {
	if(which == 'da') {
		obj.src = '/images/da_hover.jpg';
	} else {
		obj.src = '/images/nu_hover.jpg';
	}
}

function unhover_disc(obj, which) {
	if(which == 'da') {
		obj.src = '/images/da.jpg';
	} else {
		obj.src = '/images/nu.jpg';
	}
}