// JavaScript Document
function bookmarksite(){
var myloc = location.href;
var title = "ORA Dentistry Spa";
// check if active
// alert (title+"\r\n"+myloc);
if (document.all)
window.external.AddFavorite(myloc,title);
else if (window.sidebar)
window.sidebar.addPanel(title, myloc,"")
}



function sendtofriend() {
	// alert (URL);
	var URL 
	URL = location.href;
	window.open('sendtofriend.htm?page='+URL, 'EmailWindow', 'scrollbars=yes,width=650,height=355');
}

function submitForm() {
	eForm = document.emailForm;
	
	if (eForm.Nombre.value=="") {
		alert("");
		eForm.Nombre.focus();
		return;
	}
	
	else if (eForm.Telefono.value=="") {
		alert("");
		eForm.Telefono.focus();
		return;
	}
	
	
	else if (eForm.email.value=="") {
		alert(".");
		eForm.email.focus();
		return;
	}
	
	else if (eForm.Detalles.value=="") {
			alert(".");
			eForm.Detalles.focus();
			return;
	}

	document.emailForm.action="contactos.html";
	document.emailForm.submit();
	eForm.formAction.value = "Submit";
	eForm.submit();
	}

	/*
 * Image preview script 
 * powered by jQuery (http://www.jquery.com)
 * 
 * written by Alen Grakalic (http://cssglobe.com)
 * 
 * for more info visit http://cssglobe.com/post/1695/easiest-tooltip-and-image-preview-using-jquery
 *
 */
 
this.imagePreview = function(){	
	/* CONFIG */
		
		
		xOffset = 100;
		yOffset = 30;
		
		// these 2 variable determine popup's distance from the cursor
		// you might want to adjust to get the right result
		
	/* END CONFIG */
	$("a.cview").hover(function(e){
		this.t = this.title;
		this.title = "";	
		var url= $(this).attr('rel');
		var docwidth=$(document).width();
		var docheight=$(document).height();
		//alert(docwidth);
		var c = (this.t != "") ? "<br/>" + this.t : "";
		$("body").append('<div id="view">'+
		' 		<table border="0" cellspacing="0" cellpadding="0">'+
        '          <tr>'+
        '            <td width="11" height="11" valign="top"><img src="images/border-top-left.png" width="11" height="11" /></td>'+
        '            <td class="btophori"></td>'+
        '            <td width="11" height="11" valign="top"><img src="images/border-top-right.png" width="11" height="11" /></td>'+
        '          </tr>'+
        '          <tr>'+
        '            <td class="bleftvert">&nbsp;</td>'+
        '            <td class="bmain" valign="top"><img src="'+ url +'" alt="Image preview" /></td>'+
        '            <td class="brightvert">&nbsp;</td>'+
        '          </tr>'+
        '          <tr>'+
        '            <td valign="top"><img src="images/border-bottom-left.png" width="11" height="11" /></td>'+
        '            <td class="bbottomhori">&nbsp;</td>'+
        '            <td valign="top"><img src="images/border-bottom-right.png" width="11" height="11" /></td>'+
        '          </tr>'+
        '        </table>'+ c +'</div>');	
		var mleft =0;
		//alert(this.href);
		//alert(e.pageX);
		var hati = (docwidth/2)
		if(hati >  e.pageX){
			mleft = e.pageX + yOffset
		}
		else{
			mleft = e.pageX - 400 - yOffset
		}
		//alert(mleft);
		
		
		$("#view")
			.css("top",(e.pageY - xOffset) + "px")
			.css("left",(mleft) + "px")
			.fadeIn("fast");						
    },
	function(){
		this.title = this.t;	
		$("#view").remove();
    });	
	
	
	
	$("a.cview").mousemove(function(e){
		var docwidth=$(document).width();
		var docheight=$(document).height();	
		var hati = (docwidth/2)
		if(hati >  e.pageX){
			mleft = e.pageX + yOffset
		}
		else{
			mleft = e.pageX - 400 - yOffset
		}
		$("#view")
			.css("top",(e.pageY - xOffset) + "px")
			.css("left",(mleft) + "px");
	});	
	
	$("a.lyte").hover(function(e){
		this.t = this.title;
		this.title = "";	
		var url= $(this).attr('href');
		var docwidth=$(document).width();
		var docheight=$(document).height();
		//alert(docwidth);
		var c = (this.t != "") ? "<br/>" + this.t : "";
		$("body").append('<div id="view">'+
		' 		<table border="0" cellspacing="0" cellpadding="0">'+
        '          <tr>'+
        '            <td width="11" height="11" valign="top"><img src="images/border-top-left.png" width="11" height="11" /></td>'+
        '            <td class="bhori"></td>'+
        '            <td width="11" height="11" valign="top"><img src="images/border-top-right.png" width="11" height="11" /></td>'+
        '          </tr>'+
        '          <tr>'+
        '            <td class="bvert">&nbsp;</td>'+
        '            <td class="bmain" valign="top"><img src="'+ url +'" alt="Image preview" /></td>'+
        '            <td class="bvert">&nbsp;</td>'+
        '          </tr>'+
        '          <tr>'+
        '            <td valign="top"><img src="images/border-bottom-left.png" width="11" height="11" /></td>'+
        '            <td class="bhori">&nbsp;</td>'+
        '            <td valign="top"><img src="images/border-bottom-right.png" width="11" height="11" /></td>'+
        '          </tr>'+
        '        </table>'+ c +'</div>');		
		var mleft =0;
		//alert(this.href);
		//alert(e.pageX);
		var hati = (docwidth/2)
		if(hati >  e.pageX){
			mleft = e.pageX + yOffset
		}
		else{
			mleft = e.pageX - 700 - yOffset
		}
		//alert(mleft);
		
		
		$("#view")
			.css("top",(e.pageY - xOffset) + "px")
			.css("left",(mleft) + "px")
			.fadeIn("fast");						
    },
	function(){
		this.title = this.t;	
		$("#view").remove();
    });	
		
	$("a.lyte").mousemove(function(e){
		var docwidth=$(document).width();
		var docheight=$(document).height();	
		var hati = (docwidth/2)
		if(hati >  e.pageX){
			mleft = e.pageX + yOffset
		}
		else{
			mleft = e.pageX - 700 - yOffset
		}
		$("#view")
			.css("top",(e.pageY - xOffset) + "px")
			.css("left",(mleft) + "px");
	});	
	
	
	
	
	$("a.cview").click(function(){
	location.href=this.href;
	});
	
};






// starting the script on page load
$(document).ready(function(){
	imagePreview();
});




