/**
 * @author Danny Pérez Umaña
 * @copyright 2006
 */

var __SCRIPTS_PATH__ = '/common/scripts';
var __CSS_PATH__ = '/common/styles';

function include(jsFile){
	document.write('<script type="text/javascript" src="'+ jsFile + '"></script>'); 
}

function includeCSS(cssFile){
	document.write('<style type="text/css" media="all">@import "'+ cssFile + '";</style>'); 
}

function includeCondCSS(cssFile){
	document.write('<!--[if IE 6]>');
	document.write('<style type="text/css" media="all">@import '+ cssFile + '";</style>');
	document.write('<![endif]-->'); 
}

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 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 openModalDialog(w_id, w_url, w_title, w_width, w_heigth, e) {
	var win = new Window(w_id, {
						className: "alphacube",
						title: w_title,
						width:w_width, 
						height:w_heigth,
						zIndex:150,
						opacity:1,
						resizable: false,
						maximizable:false,
						recenterAuto:false,
						url: w_url,
						showEffectOptions: {duration:0.1},
						hideEffectOptions: {duration:0.1}})
	win.setDestroyOnClose();
	win.showCenter(true);
	
	return false;
}

function openFreeModalDialog(w_id, w_url, w_title, w_width, w_heigth) {
	var win = new Window(w_id, {
						className: "alphacube",
						title: w_title,
						width:w_width, 
						height:w_heigth,
						zIndex:150,
						opacity:1,
						url: w_url,
						recenterAuto:false,
						showEffectOptions: {duration:0.1},
						hideEffectOptions: {duration:0.1}})
	win.setDestroyOnClose();
	win.showCenter(true);
	
	return false;
}

function openMultiModalDialog(w_id, w_url, w_title, w_width, w_heigth) {
	var win = new Window(w_id, {
						className: "alphacube",
						title: w_title,
						width:w_width, 
						height:w_heigth,
						zIndex:150,
						opacity:1,
						url: w_url,
						recenterAuto:false,
						showEffectOptions: {duration:0.1},
						hideEffectOptions: {duration:0.1}})
	win.setDestroyOnClose();
	win.showCenter();
	
	return false;
}

function closeModalDialog(w_id, s_event){
	parent.Windows.close(w_id, s_event);
	return false;
}

function loadAndClose(r_url, w_id){
	parent.document.location.href = r_url; 
	closeModalDialog(w_id);
}
