// JavaScript Document
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 MM_findObj(n, d) { //v4.0
  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 && document.getElementById) x=document.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 poner_fecha(){
mydate = new Date();
myday = mydate.getDay();
mymonth = mydate.getMonth();
myweekday= mydate.getDate();
weekday= myweekday; 

if(myday == 0)
day = " Domingo, " 

else if(myday == 1)
day = " Lunes, " 

else if(myday == 2)
day = " Martes, " 

else if(myday == 3)
day = " Miércoles, " 

else if(myday == 4)
day = " Jueves, " 

else if(myday == 5)
day = " Viernes, " 

else if(myday == 6)
day = " Sábado, " 

if(mymonth == 0)
month = "Enero " 

else if(mymonth ==1)
month = "Febrero " 

else if(mymonth ==2)
month = "Marzo " 

else if(mymonth ==3)
month = "Abril " 

else if(mymonth ==4)
month = "Mayo " 

else if(mymonth ==5)
month = "Junio " 

else if(mymonth ==6)
month = "Julio " 

else if(mymonth ==7)
month = "Agosto " 

else if(mymonth ==8)
month = "Septiembre " 

else if(mymonth ==9)
month = "Octubre " 

else if(mymonth ==10)
month = "Noviembre " 

else if(mymonth ==11)
month = "DicTratamiento bre " 

document.write(day);
document.write(myweekday+" de "+month);
}
function getCookie(c_name)
{
var i,x,y,ARRcookies=document.cookie.split(";");
for (i=0;i<ARRcookies.length;i++)
  {
  x=ARRcookies[i].substr(0,ARRcookies[i].indexOf("="));
  y=ARRcookies[i].substr(ARRcookies[i].indexOf("=")+1);
  x=x.replace(/^\s+|\s+$/g,"");
  if (x==c_name)
    {
    return unescape(y);
    }
  }
}

function setCookie(c_name,value,exdays)
{
var exdate=new Date();
exdate.setDate(exdate.getDate() + exdays);
var c_value=escape(value) + ((exdays==null) ? "" : "; expires="+exdate.toUTCString());
document.cookie=c_name + "=" + c_value;
}

function checkCookie(){
var origen=getCookie("ceodont");
if (origen && origen!="")
  {
  //No hacer nada, mantenemos el origen
  //alert('mantiene');
  }
else{
  origen = 'Acceso directo';
  //alert('no mantiene');
  var url = window.location.toString();
  if(url && (url.indexOf('adwords', 0) > 0)){
	  origen = 'Google AdWords';
  }else if(url && (url.indexOf('facebook', 0) > 0)){
	  origen = 'Facebook';
  }else{
	  origen = document.referrer;
	  if(origen && (origen.indexOf('google', 0) > 0)){
		  origen = "Google orgánico";
	  }
  }
  setCookie("ceodont", origen, 30); 
}
}
//Checkeo de la Cookie para saber el origen de la visita
//alert(getCookie("ceodont"));
checkCookie();

