var ie4 = (document.all) ? true : false;
var ns6 = (document.getElementById && !document.all) ? true : false;
var opera = (navigator.userAgent.indexOf("Opera")!=-1)?true:false;

var arr_fotos = new Array('1','0','0','0');

function writeCaja(green_,left_,top_,width_,height_,font_color_,img_,img_w_,img_h_,link_,nombre_caja_)
{
  document.write("<div id=\"caja_" + nombre_caja_ + "\" style=\"z-Index:1;position:absolute;border: solid 1px #009900;margin-top:0px;margin-left:0px;left:" + left_ + "px;top:" + top_ + "px;width:" + (width_-(ie4?(opera?2:0):2)) + "px;height:" + (height_-(ie4?(opera?2:0):2)) + "px;background-color:#" + ((green_.indexOf("v")>=0)?"009900":"FFFFFF") + ";color:#" + font_color_ + "; \">");
  document.write("<div style=\"z-Index:1;position:absolute;margin-top:0px;margin-left:0px;left:-2px;top:-1px;width:22px;height:22px; \"><img src=\"img/esq" + green_ + "0.gif\" border=\"0\"></div>");
  document.write("<div style=\"z-Index:2;position:absolute;margin-top:0px;margin-left:0px;left:" + (width_- 23) + "px;top:-1px;width:22px;height:22px; \"><img src=\"img/esq" + green_ + "1.gif\" border=\"0\"></div>");
  document.write("<div style=\"z-Index:3;position:absolute;margin-top:0px;margin-left:0px;left:" + (width_- 23) + "px;top:" + (height_- 23) + "px;width:22px;height:22px; \"><img src=\"img/esq" + green_ + "2.gif\" border=\"0\"></div>");
  document.write("<div style=\"z-Index:4;position:absolute;margin-top:0px;margin-left:0px;left:-2px;top:" + (height_- 23) + "px;width:22px;height:22px; \"><img src=\"img/esq" + green_ + "3.gif\" border=\"0\"></div>");
  if(img_.length>0) document.write("<div style=\"z-Index:5;position:absolute;margin-top:0px;margin-left:0px;left:" + (width_ - img_w_ - 13) + "px;top:" + (height_ - img_h_ - 9) + "px;width:" + img_w_ + "px;height:" + img_h_ + "px;color:#" + font_color_ + "; \"><img src=\"" + img_ + "\" border=\"0\"></div>");
  if(link_.length>0) document.write("<div style=\"z-Index:6;position:absolute;margin-top:0px;margin-left:0px;left:0px;top:0px;width:" + (width_-2) + "px;height:" + (height_-2) + "px; \"><a href=\"" + link_ + "\"><img src=\"img/trans.gif\" width=\"" + (width_-2) + "px\" height=\"" + (height_-2) + "px\" border=\"0\"></a></div>");
  document.write("</div>");
}
function writeImg(left_,top_,width_,height_,img_,name_id_,link_,target_)
{
  document.write("<div id=\"id_" + name_id_ + "\" style=\"z-Index:1;position:absolute;margin-top:0px;margin-left:0px;left:" + left_ + "px;top:" + top_ + "px;width:" + (width_-(ie4?0:2)) + "px;height:" + (height_-(ie4?0:2)) + "px; \">");
  document.write("<div style=\"z-Index:6;position:absolute;margin-top:0px;margin-left:0px;left:0px;top:0px;width:" + (width_-2) + "px;height:" + (height_-2) + "px; \">" + ((link_.length>0)?"<a href=\"" + link_ + "\" " + ((target_!=null)?"target=\"" + target_ + "\"":"") + ">":"") + "<img src=\"" + img_ + "\" id=\"v_" + name_id_ + "\" width=\"" + (width_) + "px\" height=\"" + (height_) + "px\" border=\"0\">" + ((link_.length>0)?"</a>":"") + "</div>");
  document.write("</div>");
}
function writeletters(txt_,link_)
{
	var ret_txt_ = "";
	for(var il=0;il<txt_.length;il++)
	{
		var l_ = txt_.charAt(il);
		if(l_.indexOf(" ")==0) l_ = "blank";
		ret_txt_ += '<img src="letters/' + l_ + '.gif" border="0">';
	}
	if(link_)
		return ret_txt_;
	else
		document.write(ret_txt_);
}
function writeTxt(left_,top_,width_,height_,txt_,name_id_,link_,target_)
{
  document.write("<div id=\"id_" + name_id_ + "\" style=\"z-Index:1;position:absolute;margin-top:0px;margin-left:0px;left:" + left_ + "px;top:" + top_ + "px;width:" + (width_-(ie4?0:2)) + "px;height:" + (height_-(ie4?0:2)) + "px; \">");
  document.write("<div style=\"z-Index:6;position:absolute;margin-top:0px;margin-left:0px;left:0px;top:0px;width:" + (width_-2) + "px;height:" + (height_-2) + "px; \">" + ((link_.length>0)?"<a href=\"" + link_ + "\" " + ((target_!=null)?"target=\"" + target_ + "\"":"") + ">":"") + writeletters(txt_,1) + ((link_.length>0)?"</a>":"") + "</div>");
  document.write("</div>");
}
      
function writePubli(left_,top_,width_,height_)
{
  document.write("<div style=\"z-Index:1;position:absolute;margin-top:0px;margin-left:0px;left:" + left_ + "px;top:" + top_ + "px;width:" + (width_) + "px;height:" + (height_) + "px;background-color:#FFFFFF; \">");
	document.write("<iframe src=\"advertising/adv.php\" width=\"" + (width_) + "px\" height=\"" + (height_) + "px\" name=\"frame_publicidad\" frameborder=\"0\" scrolling=\"no\"  bgcolor=\"#FFFFFF\" marginwidth=\"0\" marginheight=\"0\"></iframe>");
	document.write("</div>");
		
}
function writeTextBox(left_,top_,width_,height_,name_form_,value_i_)
{
  document.write("<div id=\"id_" + name_form_ + "\" style=\"z-Index:1;position:absolute;margin-top:0px;margin-left:0px;left:" + left_ + "px;top:" + top_ + "px;width:" + (width_) + "px;height:" + (height_) + "px; \">");
	document.write("<form name=\"" + name_form_ + "\"><input type=\"text\" name=\"t_" + (name_form_) + "\" value=\"" + value_i_ + "\" style=\"border:1px solid #000000;color:#000000;width:" + (width_) + "px;height:" + (height_) + "px;\"></form>");
	document.write("</div>");

}
function lanzar_flash(name_form_w_,name_form_h_)
{
  var w_ = document.forms[name_form_w_].elements['t_' + name_form_w_].value;
  var h_ = document.forms[name_form_h_].elements['t_' + name_form_h_].value;
  window.open('/flash/Seeng.php?w=' + (w_) + '&h=' + (h_) + '','juego','left=0,top=0,width=' + (w_) + ',height=' + (h_) + ',scrollbars=no,status=no,resizable=no,toolbar=no,menubar=no');
}
function box(name_form_,left_,top_,value_)
{
  document.forms[name_form_ + 'w'].elements['t_' + name_form_ + 'w'].value = '' + (screen.width*value_/100); 
  document.forms[name_form_ + 'h'].elements['t_' + name_form_ + 'h'].value = '' + (screen.height*value_/100); 
  lanzar_flash(name_form_ + 'w',name_form_ + 'h');
}
function writeText(left_,top_,width_,height_,name_form_,lines_)
{
  document.write("<div id=\"id_" + name_form_ + "\" style=\"z-Index:1;position:absolute;margin-top:0px;margin-left:0px;left:" + left_ + "px;top:" + top_ + "px;width:" + (width_) + "px;height:" + (height_) + "px;color:#213549; \">");
	for(var i=0;i<lines_.length;i++)
    document.write("" + lines_[i] + "<br>");
	document.write("</div>");

}
var id_ant = -1;
function viewCajaFaqs(caja_,id_,left_,top_)
{
  document.getElementById('id_caja_' + caja_ + '_' + id_).style.left = left_;
  document.getElementById('id_caja_' + caja_ + '_' + id_).style.top = top_;
  if(id_ant>=0 && id_ant!=id_)
  {
    document.getElementById('id_caja_' + caja_ + '_' + id_ant).style.left = -1000;
    document.getElementById('id_caja_' + caja_ + '_' + id_ant).style.top = -1000;
  }
  if(left_<0) id_ = -1;
  id_ant = id_;
  document.getElementById('caja_' + caja_).style.left = left_ -16;
  document.getElementById('caja_' + caja_).style.top = top_ -15;
}
function writeTextFaqs(id_,caja_,left_,top_,width_,height_,name_form_,faq_,text_lines_,img_)
{
  document.write("<div id=\"id_" + name_form_ + "\" style=\"z-Index:1;position:absolute;margin-top:0px;margin-left:0px;left:" + left_ + "px;top:" + top_ + "px;width:" + (width_) + "px;height:20px;color:#213549; \">");
  document.write("<a href=\"#\" style=\"color:#24364C;text-decoration:none;\" onClick=\"viewCajaFaqs('" + caja_ + "','" + id_ + "',270,390);return false;\"><b>" + faq_ + "</b></a>");
	document.write("</div>");
  document.write("<div id=\"id_caja_" + caja_ + "_" + id_ + "\" style=\"z-Index:2;position:absolute;margin-top:0px;margin-left:0px;left:-1000px;top:-1000px;width:455px;height:205px;color:#213549; \">");
    //document.write("<div id=\"close_" + caja_ + "\" style=\"z-Index:2;position:absolute;margin-top:0px;margin-left:0px;left:435px;top:-10px;width:20px;height:20px;color:#213549; \">");
	  //document.write("<a href=\"#\" style=\"color:#213549;text-decoration:none;\" onClick=\"viewCajaFaqs('" + caja_ + "','" + id_ + "',-1000,-1000);return false;\"><b>[x]</b></a>");
	  //document.write("</div>");
    if(img_.length>0)
    {
      document.write("<div id=\"img_" + caja_ + "\" style=\"z-Index:2;position:absolute;margin-top:0px;margin-left:0px;left:-5px;top:0px; \">");
	    document.write("<img src=\"" + img_ + "\">");
	    document.write("</div>");
      document.write("<div id=\"img_" + caja_ + "\" style=\"z-Index:2;position:absolute;margin-top:0px;margin-left:0px;left:45px;top:0px;width:410px;height:205px;color:#213549; \">");
	  }
    for(var i=0;i<text_lines_.length;i++)
      document.write("" + text_lines_[i] + "<br>");
    if(img_.length>0)
    {
	    document.write("</div>");
    }
    document.write("<div id=\"close_img_" + caja_ + "\" style=\"z-Index:2;position:absolute;margin-top:0px;margin-left:0px;left:" + (0-top_) + "px;top:" + (0-left_) + "px;width:" + (475 + top_) + "px;height:" + (195 + left_) + "px;color:#213549; \">");
	  document.write("<a href=\"#\" style=\"color:#213549;text-decoration:none;\" onClick=\"viewCajaFaqs('" + caja_ + "','" + id_ + "',-1000,-1000);return false;\"><img src=\"img/trans.gif\" border=\"0\" width=\"" + (475 + top_) + "px\" height=\"" + (195 + left_) + "px\" galleryimg=\"no\"></a>");
	  document.write("</div>");
  
	document.write("</div>");

}
function drawHorizontalLine(left_, top_, width_, height_, color_) {
  //if(ie4) top_ -= 8;
  document.write("<div style=\"z-Index:1;position:absolute;margin-top:0px;margin-left:0px;left:" + left_ + "px;top:" + top_ + "px;width:" + (width_) + "px;height:" + (height_) + "px;border-top: 1px solid #" + color_ +";\">");
	document.write("</div>");
}
function drawVerticalLine(left_, top_, width_, height_, color_) {
  if(ie4) height_ -= 8;
  document.write("<div style=\"z-Index:1;position:absolute;margin-top:0px;margin-left:0px;left:" + left_ + "px;top:" + top_ + "px;width:" + (width_) + "px;height:" + (height_) + "px;border-left: 1px solid #" + color_ +";\">");
	document.write("</div>");
}
function datos(left_f,top_f,name_f,left_t,top_t,name_t)
{
    document.getElementById('id_' + name_f).style.left = left_f;
    document.getElementById('id_' + name_f).style.top = top_f;
    
    document.getElementById('id_' + texto_actual_).style.left = -1000;
    document.getElementById('id_' + texto_actual_).style.top = -1000;
    texto_actual_ = name_t;
    document.getElementById('id_' + texto_actual_).style.left = left_t;
    document.getElementById('id_' + texto_actual_).style.top = top_t;
}
function writeForm(name_form_,action_)
{
  document.write("<form name=\"" + name_form_ + "\" action=\"" + action_ + "\" method=\"POST\">");
}
function closeForm()
{
  document.write("</form>");
}
function writeTextField(left_,top_,width_,height_,name_form_,value_i_,color_,passwd_)
{
  document.write("<div id=\"id_" + name_form_ + "\" style=\"z-Index:1;position:absolute;margin-top:0px;margin-left:0px;left:" + left_ + "px;top:" + top_ + "px;width:" + (width_) + "px;height:" + (height_) + "px; \">");
	document.write("<input type=\"" + ((passwd_==1)?"password":"text") + "\" name=\"t_" + (name_form_) + "\" value=\"" + value_i_ + "\" style=\"border:1px solid #" + color_ + ";color:#000000;width:" + (width_) + "px;height:" + (height_) + "px;\">");
	document.write("</div>");

}
function writeTextArea(left_,top_,width_,height_,name_form_,value_i_,color_,passwd_)
{
  document.write("<div id=\"id_" + name_form_ + "\" style=\"z-Index:1;position:absolute;margin-top:0px;margin-left:0px;left:" + left_ + "px;top:" + top_ + "px;width:" + (width_) + "px;height:" + (height_) + "px; \">");
	document.write("<textarea name=\"t_" + (name_form_) + "\"  style=\"border:1px solid #" + color_ + ";color:#000000;width:" + (width_) + "px;height:" + (height_) + "px;\">" + value_i_ + "</textarea>");
	document.write("</div>");

}
var checkmail_ = 1;
function checkmail(name_form_,text_field_,left_,top_,img_name_)
{
    checkmail_++;
    if(checkmail_>1) checkmail_=0;
    document.getElementById('id_' + img_name_).style.left = ((checkmail_==0)?-1000:left_);
    document.getElementById('id_' + img_name_).style.top = ((checkmail_==0)?-1000:top_);
    document.forms[name_form_].elements['t_' + text_field_].value = checkmail_;
}
function sendSubmit(name_form_,name_password_)
{
    if(name_password_=='')
    {
      ;
    }
    else
    {
      if(document.forms[name_form_].elements['t_' + name_password_].value.length>0)
        document.forms[name_form_].elements['t_' + name_password_].value = calcMD5c(document.forms[name_form_].elements['t_' + name_password_].value);
    }
    document.forms[name_form_].submit();
}
function openlinkds(url_)
{
  alert(1);
  //window.open(url_,'','');
  return false;
}
