﻿var newwindow = '';


var cont = '';
var w=420;
var h=470;
var winl = (screen.width - w) / 2;
var wint = (screen.height - h) / 2;

function contacto(url)
{
    openp(url);
}


function openp(url)
{
	if (!cont.closed && cont.location)
	{
		cont.location.href = url;
	}
	else
	{
		cont=window.open(url,'Contacto','height='+h+',width='+w+',top='+wint+',left='+winl+'resizable=0');
		if (!cont.opener) cont.opener = self;
	}
	if (window.focus) {cont.focus()}
	return false;
}


function akeru(doko)
{
    openpopup(doko);
}


function openpopup(doko)
{
	if (!newwindow.closed && newwindow.location)
	{
		newwindow.location.href = doko;
	}
	else
	{
		newwindow=window.open(doko,'Enlace');
		if (!newwindow.opener) newwindow.opener = self;
        
	}
	if (window.focus) {newwindow.focus();}
	return false;
}

function nihongo()
{
    var url = window.location.href;
    if (url.indexOf("/sup")>-1)
    {
        var migi=url.substr(url.indexOf("/sup")+4);
        migi = url.substring(0, url.indexOf("/sup"))  + "/nih" + migi;
        window.location.href=migi;
    }
    if (url.indexOf("/eng")>-1)
    {
        var migi=url.substr(url.indexOf("/eng")+4);
        migi = url.substring(0, url.indexOf("/eng"))  + "/nih" + migi;
        window.location.href=migi;
    	
    }
    

}

function castellano()
{
var url = window.location.href;
var migi;

  if (url.indexOf("/nih")>-1) 
  {
  	migi=url.substr(url.indexOf("/nih")+4);
  	migi = url.substring(0, url.indexOf("/nih"))  + "/sup" + migi;
  }
    if (url.indexOf("/eng")>-1)
    {
        var migi=url.substr(url.indexOf("/eng")+4);
        migi = url.substring(0, url.indexOf("/eng"))  + "/sup" + migi;
    }
		window.location.href=migi;

}

function english()
{
	var url = window.location.href;
if (url.indexOf("/nih")>-1)
    {
        var migi=url.substr(url.indexOf("/nih")+4);
        migi = url.substring(0, url.indexOf("/nih"))  + "/eng" + migi;
        window.location.href=migi;
    }
    if (url.indexOf("/sup")>-1)
    {
        var migi=url.substr(url.indexOf("/sup")+4);
        migi = url.substring(0, url.indexOf("/sup"))  + "/eng" + migi;
        window.location.href=migi;
    }
}
