
/**************************************************************

	Script		: Cocoabio
	Version		: 1.0
	Author		: Rodolfo Buaiz
	Desc		: special site functions
	Licence		: use as u wish

**************************************************************/


//window.addEvent('domready',function() { new SmoothScroll({ duration: 800 }); }); 


// put the following anchor just after the <body> tag
// <a name="home" id="home"></a>
function moveWindow() 
{
	var myFx = new Fx.Scroll(window).toElement('home');
}


// the <div id="page"> contains the <div id="flashcontent">
var theHeight;

function newSize(h) 
{
	var the_layer;
	if(document.all && !document.getElementById) {
		the_layer = document.all['page'].style;
		the_layer.pixelHeight = h;
	}else{
		the_layer = document.getElementById('page').style;
		the_layer.height = h;
	}
	//moveWindow();
}


function locacion(c) 
{
	document.location.href = c;
}	

function refresh() 
{
	location.reload(true);
}	

function www(o,c)
{ 
	w = 1120;
	h = 600;
	LeftPosition = (screen.width) ? (screen.width-w)/2 : 0;
	TopPosition = (screen.height) ? (screen.height-h)/2 : 0;
	options = 'width='+w+ ',height='+h+ ',top='+TopPosition+',left='+LeftPosition+',resizable=1,menubar='+c+',toolbar='+c+',location='+c+',directories=0,scrollbars=1';
	newWin=window.open(o, 'Tulipanes', options); 
} 


function f_scrollTop() 
{
	return f_filterResults (
		window.pageYOffset ? window.pageYOffset : 0,
		document.documentElement ? document.documentElement.scrollTop : 0,
		document.body ? document.body.scrollTop : 0
	);
}


function f_filterResults(n_win, n_docel, n_body) 
{
	var n_result = n_win ? n_win : 0;
	if (n_docel && (!n_result || (n_result > n_docel)))
		n_result = n_docel;
	return n_body && (!n_result || (n_result > n_body)) ? n_body : n_result;
}


function whatCenter(name) 
{
	var retorno = [getViewportSize(), f_scrollTop()];
    return retorno;
}


function getViewportSize() 
{ 
	var size = [0, 0]; 
	if (typeof window.innerWidth != "undefined") 
	{ 
		size = [window.innerWidth, window.innerHeight];
	} 
	else if (typeof document.documentElement != "undefined" && typeof document.documentElement.clientWidth != "undefined" && document.documentElement.clientWidth != 0) 
	{
		size = [document.documentElement.clientWidth, document.documentElement.clientHeight]; 
	}
	else 
	{
		size = [document.getElementsByTagName("body")[0].clientWidth, document.getElementsByTagName("body")[0].clientHeight]; 
	}
	return size[1]; 
}




function warnFlash() 
{
	document.documentElement.style.overflow = 'scroll';
 	var meuflash = getFlashMovie("flashcontent");
	//alert(meuflash);
	meuflash.warnFlash();
}

function getFlashMovie(movieName) 
{
  if (window.document[movieName]){
      return window.document[movieName];
  }
  if (navigator.appName.indexOf("Microsoft Internet")==-1){
    if (document.embeds && document.embeds[movieName])
      return document.embeds[movieName]; 
  }
  else {
    return document.getElementById(movieName);
  }
}

function shadownews(c,t)
{
	document.documentElement.style.overflow = 'hidden';
	viewport();
	var aw = viewportwidth;
	var ah = viewportheight - 100;
    Shadowbox.open({
        player:     'iframe',
        content:    c,
		title:      t,
        height:     ah,
        width:      aw
    });

};

function youtube(c, w, h, tit)
{
    Shadowbox.open({
        player:     "swf",
        content:    c,
		title: 		tit,
        height:     h,
        width:      w
    });

};

function sizedbox(c,t,w,h)
{
    Shadowbox.open({
        player:     'iframe',
        content:    c,
		title:      t,
        height:     h,
        width:      w
    });

};

function viewport() 
{

	 // the more standards compliant browsers (mozilla/netscape/opera/IE7) use window.innerWidth and window.innerHeight
	 if (typeof window.innerWidth != 'undefined') {
	      viewportwidth = window.innerWidth,
	      viewportheight = window.innerHeight
	 }

	// IE6 in standards compliant mode (i.e. with a valid doctype as the first line in the document)
	 else if (typeof document.documentElement != 'undefined'
	     && typeof document.documentElement.clientWidth !=
	     'undefined' && document.documentElement.clientWidth != 0) {
	       viewportwidth = document.documentElement.clientWidth,
	       viewportheight = document.documentElement.clientHeight
	 }

	 // older versions of IE
	 else {
	       viewportwidth = document.getElementsByTagName('body')[0].clientWidth,
	       viewportheight = document.getElementsByTagName('body')[0].clientHeight
	 }
}
