// empieza tema fuentes

ACTUAL_FONTSIZE = 10;
SMALLEST_FONTSIZE = 9;
LARGEST_FONTSIZE = 20;	

// FONT SIZE MANAGEMENT 
function FindObj(n, d) { //v4.01
var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=FindObj(n,d.layers[i].document);
if(!x && d.getElementById) x=d.getElementById(n); return x;
}

function ChangeProp(objName,x,theProp,theValue) { //v6.0
var obj = FindObj(objName);
if (obj && (theProp.indexOf("style.")==-1 || obj.style)){
if (theValue == true || theValue == false)
eval("obj."+theProp+"="+theValue);
else eval("obj."+theProp+"='"+theValue+"'");
}
}
// FONT SIZE MANAGEMENT 
function FindObj(n, d) { //v4.01
var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=FindObj(n,d.layers[i].document);
if(!x && d.getElementById) x=d.getElementById(n); return x;
}

function ChangeProp(objName,x,theProp,theValue) { //v6.0
var obj = FindObj(objName);
if (obj && (theProp.indexOf("style.")==-1 || obj.style)){
if (theValue == true || theValue == false)
eval("obj."+theProp+"="+theValue);
else eval("obj."+theProp+"='"+theValue+"'");
}
}

// FONT SIZE MANAGEMENT 
function LoadActualFontSize() {
tempArray = document.cookie.split(";");
for (tA = 0; tA < tempArray.length; tA++){
if (tempArray[tA].indexOf('fontSize') > -1){
fontSizeValue = tempArray[tA].split("=")
ACTUAL_FONTSIZE = parseInt(fontSizeValue[1]);
}
}
}
function SaveActualFontSize() {
var expire = new Date ();
expire.setTime (expire.getTime() + (6000 * 24 * 3600000));
expire = expire.toGMTString();
document.cookie="fontSize="+ACTUAL_FONTSIZE+"; path=/; expires="+expire;
}

function Bigger() {
ACTUAL_FONTSIZE = ACTUAL_FONTSIZE+1;
if (ACTUAL_FONTSIZE > LARGEST_FONTSIZE) { ACTUAL_FONTSIZE = LARGEST_FONTSIZE }
ChangeProp('texto','','style.fontSize',ACTUAL_FONTSIZE,'SPAN');
SaveActualFontSize();
}
function Smaller() {
ACTUAL_FONTSIZE = ACTUAL_FONTSIZE-1
if (ACTUAL_FONTSIZE < SMALLEST_FONTSIZE) { ACTUAL_FONTSIZE = SMALLEST_FONTSIZE }
ChangeProp('texto','','style.fontSize',ACTUAL_FONTSIZE,'SPAN');
SaveActualFontSize();
}


// termina tema fuentes


function hide(cual){

cualid = "pic" + cual

	document.getElementById(cualid).style.visibility = "hidden";

}


var pic=0
var elpic=MM_findObj('elpic');

function showpic(id){
elpic.src =  id ;
}


function ShowPic(sImage)
{
sImage =  sImage;
document.ShowRoom.src = sImage;
}




//Pop-it menu- By Dynamic Drive
//For full source code and more DHTML scripts, visit http://www.dynamicdrive.com
//This credit MUST stay intact for use

var linkset=new Array()
//SPECIFY MENU SETS AND THEIR LINKS. FOLLOW SYNTAX LAID OUT

linkset[0]='<div class="menu"><a class=menu href="menu.php?GroupID=Dreams_Cinema">- Dreams Cinema</a></div>'
linkset[0]+='<div class="menu"><a class=menu  href="menu.php?GroupID=Cine_Cite">- UGC Ciné Cité </a></div>'
linkset[0]+='<div class="menu"><a class=menu  href="menu.php?GroupID=Cine_Sur">- Cine Sur</a></div>'
linkset[0]+='<div class="menu"><a class=menu  href="menu.php?GroupID=Filmotecas">- Filmotecas</a></div>'


////No need to edit beyond here

var ie4=document.all
var ns6=document.getElementById&&!document.all
var ns4=document.layers

function showmenu(e,which){

if (!document.all&&!document.getElementById&&!document.layers)
return

clearhidemenu()

menuobj=ie4? document.all.popmenu : ns6? document.getElementById("popmenu") : ns4? document.popmenu : ""
menuobj.thestyle=(ie4||ns6)? menuobj.style : menuobj

if (ie4||ns6)
menuobj.innerHTML=which
else{
menuobj.document.write('<layer name=gui bgColor=#E6E6E6 width=150 onmouseover="clearhidemenu()" onmouseout="hidemenu()">'+which+'</layer>')
menuobj.document.close()
}

menuobj.contentwidth=(ie4||ns6)? menuobj.offsetWidth : menuobj.document.gui.document.width
menuobj.contentheight=(ie4||ns6)? menuobj.offsetHeight : menuobj.document.gui.document.height
eventX=ie4? event.clientX : ns6? e.clientX : e.x
eventY=ie4? event.clientY : ns6? e.clientY : e.y

//Find out how close the mouse is to the corner of the window
var rightedge=ie4? document.body.clientWidth-eventX : window.innerWidth-eventX
var bottomedge=ie4? document.body.clientHeight-eventY : window.innerHeight-eventY

//if the horizontal distance isn't enough to accomodate the width of the context menu
if (rightedge<menuobj.contentwidth)
//move the horizontal position of the menu to the left by it's width
menuobj.thestyle.left=ie4? document.body.scrollLeft+eventX-menuobj.contentwidth : ns6? window.pageXOffset+eventX-menuobj.contentwidth : eventX-menuobj.contentwidth
else
//position the horizontal position of the menu where the mouse was clicked
menuobj.thestyle.left=ie4? document.body.scrollLeft+eventX : ns6? window.pageXOffset+eventX : eventX

//same concept with the vertical position
if (bottomedge<menuobj.contentheight)
menuobj.thestyle.top=ie4? document.body.scrollTop+eventY-menuobj.contentheight : ns6? window.pageYOffset+eventY-menuobj.contentheight : eventY-menuobj.contentheight
else
menuobj.thestyle.top=ie4? document.body.scrollTop+event.clientY : ns6? window.pageYOffset+eventY : eventY
menuobj.thestyle.visibility="visible"
return false
}

function contains_ns6(a, b) {
//Determines if 1 element in contained in another- by Brainjar.com
while (b.parentNode)
if ((b = b.parentNode) == a)
return true;
return false;
}

function hidemenu(){
if (window.menuobj)
menuobj.thestyle.visibility=(ie4||ns6)? "hidden" : "hide"
}

function dynamichide(e){
if (ie4&&!menuobj.contains(e.toElement))
hidemenu()
else if (ns6&&e.currentTarget!= e.relatedTarget&& !contains_ns6(e.currentTarget, e.relatedTarget))
hidemenu()
}

function delayhidemenu(){
if (ie4||ns6||ns4)
delayhide=setTimeout("hidemenu()",500)
}

function clearhidemenu(){
if (window.delayhide)
clearTimeout(delayhide)
}

function highlightmenu(e,state){
if (document.all)
source_el=event.srcElement
else if (document.getElementById)
source_el=e.target
if (source_el.className=="menuitems"){
source_el.id=(state=="on")? "mouseoverstyle" : ""
}
else{
while(source_el.id!="popmenu"){
source_el=document.getElementById? source_el.parentNode : source_el.parentElement
if (source_el.className=="menuitems"){
source_el.id=(state=="on")? "mouseoverstyle" : ""
}
}
}
}

if (ie4||ns6)
document.onclick=hidemenu


/* this is to keep people from stealing bandwidth */
/* remove this to run this on your own server */

/* var _turl=document.location.toString();
if (_turl.indexOf("localhost") == -1 &&
    _turl.indexOf("localhost") == -1) {
  top.document.location="localhost";
}
*/
/* this is to keep people from stealing bandwidth */


isNS = document.layers?true:false;
isIE = navigator.appName.indexOf("Microsoft") != -1
isNS6 = !isIE && document.getElementById?true:false;

function NewDiv(window, id, body, left, top, width, height, zIndex, absolute) {
    this.window = window;
    this.id     = id;
    this.body   = body;
    var d = window.document;
    d.writeln('<STYLE TYPE="text/css">#' + id + ' {');
	if (absolute) d.write('position:absolute;');
	else          d.write('position:relative;');
    if (left)   d.write('left:'  + left  + ';');
    if (top)    d.write('top:'   + top   + ';');
    if (width)  d.write('width:' + width + ';');
	if (height) d.write('height:' + height + ';');
	if (zIndex) d.write('z-index:' + zIndex + ';');
    d.writeln('}</STYLE>');
}
if (isNS) {
    NewDiv.prototype.output             = function()      { var d = this.window.document;d.writeln('<DIV ID="' + this.id + '">');d.writeln(this.body);d.writeln("</DIV>");this.layer = d[this.id];}
    NewDiv.prototype.moveTo             = function(x,y)   { this.layer.moveTo(x,y); }
    NewDiv.prototype.moveBy             = function(x,y)   { this.layer.moveBy(x,y); }
    NewDiv.prototype.show               = function()      { this.layer.visibility = "show"; }
    NewDiv.prototype.hide               = function()      { this.layer.visibility = "hide"; }
    NewDiv.prototype.setZ               = function(z)     { this.layer.zIndex = z; }
    NewDiv.prototype.setBgColor         = function(color) { this.layer.bgColor = color; }
    NewDiv.prototype.setBgImage         = function(image) { this.layer.background.src = image;}
    NewDiv.prototype.getX               = function() { return this.layer.left; }
    NewDiv.prototype.getY               = function() { return this.layer.top; } //was right .. ??
    NewDiv.prototype.getWidth           = function() { return this.layer.width; }
    NewDiv.prototype.getHeight          = function() { return this.layer.height; }
    NewDiv.prototype.getZ               = function() { return this.layer.zIndex; }
    NewDiv.prototype.isVisible          = function() { return this.layer.visibility == "show"; }
    NewDiv.prototype.setBody            = function() { for(var i = 0; i < arguments.length; i++) this.layer.document.writeln(arguments[i]);this.layer.document.close();}
    NewDiv.prototype.addEventHandler    = function(eventname, handler) {this.layer.captureEvents(NewDiv._eventmasks[eventname]); var newdivel = this;this.layer[eventname] = function(event) { return handler(newdivel, event.type, event.x, event.y, event.which, event.which,((event.modifiers & Event.SHIFT_MASK) != 0),((event.modifiers & Event.CTRL_MASK)  != 0),((event.modifiers & Event.ALT_MASK)   != 0));}}
    NewDiv.prototype.removeEventHandler = function(eventname)          {this.layer.releaseEvents(NewDiv._eventmasks[eventname]);delete this.layer[eventname];}
    NewDiv.prototype.centerX            = function() {this.layer.moveTo(Math.round((window.pageXOffset+document.width-100)/2),this.layer.top)}
    NewDiv._eventmasks                  = {onabort:Event.ABORT,onblur:Event.BLUR,onchange:Event.CHANGE,onclick:Event.CLICK,ondblclick:Event.DBLCLICK, ondragdrop:Event.DRAGDROP,onerror:Event.ERROR, onfocus:Event.FOCUS,onkeydown:Event.KEYDOWN,onkeypress:Event.KEYPRESS,onkeyup:Event.KEYUP,onload:Event.LOAD,onmousedown:Event.MOUSEDOWN,onmousemove:Event.MOUSEMOVE, onmouseout:Event.MOUSEOUT,onmouseover:Event.MOUSEOVER, onmouseup:Event.MOUSEUP,onmove:Event.MOVE,onreset:Event.RESET,onresize:Event.RESIZE,onselect:Event.SELECT,onsubmit:Event.SUBMIT,onunload:Event.UNLOAD};
}

if (isIE) {
    NewDiv.prototype.output             = function()                   { var d = this.window.document;d.writeln('<DIV ID="' + this.id + '">');d.writeln(this.body);d.writeln("</DIV>");this.element = d.all[this.id];this.style = this.element.style;}
    NewDiv.prototype.moveTo             = function(x,y)                { this.style.pixelLeft = x;this.style.pixelTop = y;}
    NewDiv.prototype.moveBy             = function(x,y)                { this.style.pixelLeft += x;this.style.pixelTop += y;}
    NewDiv.prototype.show               = function()                   { this.style.visibility = "visible"; }
    NewDiv.prototype.hide               = function()                   { this.style.visibility = "hidden"; }
    NewDiv.prototype.setZ               = function(z)                  { this.style.zIndex = z; }
    NewDiv.prototype.setBgColor         = function(color)              { this.style.backgroundColor = color; }
    NewDiv.prototype.setBgImage         = function(image)              { this.style.backgroundImage = image;}
    NewDiv.prototype.getX               = function()                   { return this.style.pixelLeft; }
    NewDiv.prototype.getY               = function()                   { return this.style.pixelRight; }
    NewDiv.prototype.getWidth           = function()                   { return this.style.width; }
    NewDiv.prototype.getHeight          = function()                   { return this.style.height; }
    NewDiv.prototype.getZ               = function()                   { return this.style.zIndex; }
    NewDiv.prototype.isVisible          = function()                   { return this.style.visibility == "visible"; }
    NewDiv.prototype.setBody            = function()                   { var body = "";for(var i = 0; i < arguments.length; i++) {body += arguments[i] + "\n";}this.element.innerHTML = body;}
    NewDiv.prototype.addEventHandler    = function(eventname, handler) { var NewDiv = this;this.element[eventname] = function() { var e = NewDiv.window.event;e.cancelBubble = true;return handler(NewDiv, e.type, e.x, e.y, e.button, e.keyCode, e.shiftKey, e.ctrlKey, e.altKey); }}
    NewDiv.prototype.removeEventHandler = function(eventname)          { delete this.element[eventname];}
	NewDiv.prototype.centerX            = function()                   { this.style.pixelLeft=Math.round((document.body.clientWidth+document.body.scrollLeft-300)/2)}
}

/*
 * The following was written by:
 *   Dario Guzik
 *      Spam unfriendly email address: dguzik AT bigfoot DOT com
 */
if (isNS6) {
    NewDiv.prototype.output             = function()                   { var d = this.window.document;d.writeln('<DIV ID="' + this.id + '">');d.writeln(this.body);d.writeln("</DIV>");this.element = d.getElementById(this.id);this.style = this.element.style;}
    NewDiv.prototype.moveTo             = function(x,y)                { this.style.pixelLeft = x;this.style.pixelTop = y;}
    NewDiv.prototype.moveBy             = function(x,y)                { this.style.pixelLeft += x;this.style.pixelTop += y;}
    NewDiv.prototype.show               = function()                   { this.style.visibility = "visible"; }
    NewDiv.prototype.hide               = function()                   { this.style.visibility = "hidden"; }
    NewDiv.prototype.setZ               = function(z)                  { this.style.zIndex = z; }
    NewDiv.prototype.setBgColor         = function(color)              { this.style.backgroundColor = color; }
    NewDiv.prototype.setBgImage         = function(image)              { this.style.backgroundImage = image;}
    NewDiv.prototype.getX               = function()                   { return this.style.pixelLeft; }
    NewDiv.prototype.getY               = function()                   { return this.style.pixelRight; }
    NewDiv.prototype.getWidth           = function()                   { return this.style.width; }
    NewDiv.prototype.getHeight          = function()                   { return this.style.height; }
    NewDiv.prototype.getZ               = function()                   { return this.style.zIndex; }
    NewDiv.prototype.isVisible          = function()                   { return this.style.visibility == "visible"; }
    NewDiv.prototype.setBody            = function()                   { var body = "";for(var i = 0; i < arguments.length; i++) {body += arguments[i] + "\n";}this.element.innerHTML = body;}
    NewDiv.prototype.addEventHandler    = function(eventname, handler) { var NewDiv = this;this.element[eventname] = function() { var e = NewDiv.window.event;e.cancelBubble = true;return handler(NewDiv, e.type, e.x, e.y, e.button, e.keyCode, e.shiftKey, e.ctrlKey, e.altKey); }}
    NewDiv.prototype.removeEventHandler = function(eventname)          { delete this.element[eventname];}
  NewDiv.prototype.centerX            = function()                   { this.style.pixelLeft=Math.round((document.body.clientWidth+document.body.scrollLeft-300)/2)}
}


var isIE=document.all?true:false; /* IE4, IE5, IE6 */
var isDOM=document.getElementById?true:false; /* IE6, NS6 */
function SH(_objName,_formObj)
{
 
  _formObj._show=_formObj._show?false:true;
  
    if(isDOM)
  {
    if(_formObj._show)
      document.getElementById(_objName).style.display="";
	else
      document.getElementById(_objName).style.display="none";
  }
  else if(isIE)
  {
    if(_formObj._show)
      eval("document.all."+_objName+".style.display=''");
    else
      eval("document.all."+_objName+".style.display=''");
  }
}

function pop_up(link, height, width)
{
window.open(link,'','height='+height+',width='+width+',toolbar=no,menubar=no,location=no,status=no');
}

function pop_up_scroll(link, height, width)
{
window.open(link,'','height='+height+',width='+width+',scrollbars=yes,toolbar=no,menubar=no,location=no,status=no');
}

function value(object)
	{
	var i;
	for(i=0;i<object.length;i++)
		{
		if(object[i].checked)
			break;
		}
	return object[i].value;
	}

function printarcticle(id)
{
//pop_up(
}

//funcion que checkea un email.
function emailCheck (emailStr) 
{
var emailPat=/^(.+)@(.+)$/
var specialChars="\\(\\)<>@,;:\\\\\\\"\\.\\[\\]"
var validChars="\[^\\s" + specialChars + "\]"
var quotedUser="(\"[^\"]*\")"
var ipDomainPat=/^\[(\d{1,3})\.(\d{1,3})\.(\d{1,3})\.(\d{1,3})\]$/
var atom=validChars + '+'
var word="(" + atom + "|" + quotedUser + ")"
var userPat=new RegExp("^" + word + "(\\." + word + ")*$")
var domainPat=new RegExp("^" + atom + "(\\." + atom +")*$")
var matchArray=emailStr.match(emailPat)
if (matchArray==null) {
	return false
}
var user=matchArray[1]
var domain=matchArray[2]
if (user.match(userPat)==null) {
    return false
}
var IPArray=domain.match(ipDomainPat)
if (IPArray!=null) {
	  for (var i=1;i<=4;i++) {
	    if (IPArray[i]>255) {
		return false
	    }
    }
    return true
}

var domainArray=domain.match(domainPat)
if (domainArray==null) {
	return false
}
var atomPat=new RegExp(atom,"g")
var domArr=domain.match(atomPat)
var len=domArr.length
if (domArr[domArr.length-1].length<2 || 
    domArr[domArr.length-1].length>3) {
   return false
}
if (len<2) {
   return false
}
return true;
}

//trim functions
function ltrim ( s )
{
	return s.replace( /^\s*/, "" )
}

function rtrim ( s )
{
	return s.replace( /\s*$/, "" );
}

//Combine the rtrim() and ltrim() functions to make the trim() function, which just wraps both calls together:

function trim ( s )
{
	return rtrim(ltrim(s));
}



function MM_findObj(n, d) { //v4.01
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
  if(!x && d.getElementById) x=d.getElementById(n); return x;
}
function MM_swapImage() { //v3.0
  var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
   if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}
function MM_swapImgRestore() { //v3.0
  var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}

function MM_preloadImages() { //v3.0
 var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
   var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
   if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}

function navegar(direccion, nueva_ventana){ 
      if(direccion.toLowerCase().substring(0,3) == "www") 
            direccion = "http://" + direccion 
        if(direccion != ""){ 
            if (nueva_ventana) 
                window.open(direccion); 
            else 
                location.href = direccion; 
        } 
} 

function ok(){
if (document.formu.nombre.value=="" || document.formu.apellido.value=="" || document.formu.email.value=="" || document.formu.pais.value=="" || document.formu.mensaje.value=="") {
	alert('Completar los campos obligatorios del formulario de contacto por favor');
	return false;
	}
else {return true;}
}
