function showVideo(){
	var thediv=document.getElementById('displaybox');
	if(thediv.style.display == "none"){
		thediv.style.display = "";
		thediv.innerHTML = "<br/><br/><br/><object type='application/x-shockwave-flash' data='cardio.swf' width='580' height='430'><param name='movie' value='cardio.swf' /><param name='quality' value='high'/></object><br/><br/><a href='javascript:' onclick='return showVideo();' style='background-color:#FFFFFF; padding:5px 5px 5px 5px; color:#000000;'><strong>INCHIDE</strong></a>";
	}else{
		thediv.style.display = "none";
		thediv.innerHTML = '';
	}
}

function showPub() {
	var thediv=document.getElementById('displayboxpub');
	if(thediv.style.display == "none"){
		thediv.style.display = "";
		thediv.innerHTML = "<br/><br/><br/><img src='reducere_20procente.jpg' onclick='return showPub();' /><br/><br/><a href='javascript:' onclick='return showPub();' style='background-color:#FFFFFF; padding:5px 5px 5px 5px; color:#000000;'><strong>INCHIDE</strong></a>";
	}else{
		thediv.style.display = "none";
		thediv.innerHTML = '';
	}
}

function resetStyle(obj,st) {
	if (!(obj.value=="" || obj.value==null)) {
		obj.className = st;
	}
}

function checkEnterSearch(e){
var characterCode;// literal character code will be stored in this variable

if(e && e.which){ //if which property of event object is supported (NN4)
e = e;
characterCode = e.which; //character code is contained in NN4's which property
}
else{
e = event;
characterCode = e.keyCode; //character code is contained in IE's keyCode property
}

if(characterCode == 13){ //if generated character code is equal to ascii 13 (if enter key)
siteSearch(); //submit the form
return false;
}
else{
return true;
}
}

function siteSearch() {

	var term = document.getElementById("searchterm").value;
	
	if (term=="" || term==null || term.length<3) {
		alert("Introduceti un termen de cautare de cel putin 3 caractere");
	} else {
		top.location.href="http://www.cardiomedcluj.ro/cautare/?"+term;
	}

}

function validEmail(address) {

if (address.length==0) {
  return (true);
}
else
{
if (address.length>=6) {
if (address.indexOf("@")>0) {
if ((address.indexOf("@")+1)<address.lastIndexOf(".")) {
if (address.lastIndexOf(".")<(address.length-2)) {
return (true);
}
}
}
}
}
return (false);
}

function sendMessage_faq() {

	var err="";
	
	// verificam campurile obligatorii
    for (var i=0; i<document.activeForm.length; i++) {
	    n = document.activeForm[i].name;
		id = document.activeForm[i].id;
	    v = document.activeForm[i].value;

	    if ((v=="" || v==null) && n.substr(0,4)=="smc_") {
		    err="Completati toate campurile obligatorii marcate cu *";
			if (n!="smc_mesaj") document.getElementById(id).className = "inputbox_f1red";
		}
		if (!((v=="" || v==null)) && n=="smc_email" && !validEmail(v)) {
			err = "Adresa de e-mail introdusa nu este intr-un format valid. Corectati ...";
			document.getElementById(id).className = "inputbox_f1red";
		}
		
		if ((v=="" || v==null) && n=="smc_mesaj") {
			document.getElementById(id).className = "inputbox_f3red";
		}
		
    }
	
	if (err=="") {
		document.activeForm.submit();
	} else {
		alert(err);
	}

}

function sendMessage_programare() {

	var err="";
	
	// verificam campurile obligatorii
    for (var i=0; i<document.activeForm.length; i++) {
	    n = document.activeForm[i].name;
		id = document.activeForm[i].id;
	    v = document.activeForm[i].value;

	    if ((v=="" || v==null) && n.substr(0,4)=="smc_") {
		    err="Completati toate campurile obligatorii marcate cu *";
			if (n!="smc_mesaj") document.getElementById(id).className = "inputbox_f1red";
		}
		if (!((v=="" || v==null)) && n=="smc_email" && !validEmail(v)) {
			err = "Adresa de e-mail introdusa nu este intr-un format valid. Corectati ...";
			document.getElementById(id).className = "inputbox_f1red";
		}
		
		if ((v=="" || v==null) && n=="smc_mesaj") {
			document.getElementById(id).className = "inputbox_f3red";
		}
		
    }
	
	if (err=="") {
		document.activeForm.submit();
	} else {
		alert(err);
	}

}

function sendMessage_contact() {

	var err="";
	
	// verificam campurile obligatorii
    for (var i=0; i<document.activeForm.length; i++) {
	    n = document.activeForm[i].name;
		id = document.activeForm[i].id;
	    v = document.activeForm[i].value;

	    if ((v=="" || v==null) && n.substr(0,4)=="smc_") {
		    err="Completati toate campurile obligatorii marcate cu *";
			if (n!="smc_mesaj") document.getElementById(id).className = "inputbox_f1red";
		}
		if (!((v=="" || v==null)) && n=="smc_email" && !validEmail(v)) {
			err = "Adresa de e-mail introdusa nu este intr-un format valid. Corectati ...";
			document.getElementById(id).className = "inputbox_f1red";
		}
		
		if ((v=="" || v==null) && n=="smc_mesaj") {
			document.getElementById(id).className = "inputbox_f3red";
		}
		
    }
	
	if (err=="") {
		document.activeForm.submit();
	} else {
		alert(err);
	}

}

function ietruebody(){
	return (document.compatMode && document.compatMode!="BackCompat")? document.documentElement : document.body
}

function ddrivetip(thetext, thecolor, thewidth){
	if (ns6||ie){
	if (typeof thewidth!="undefined") tipobj.style.width=thewidth+"px"
	if (typeof thecolor!="undefined" && thecolor!="") tipobj.style.backgroundColor=thecolor
	tipobj.innerHTML=thetext
	enabletip=true
	return false
	}
}

function positiontip(e){

if (enabletip){

var curX=(ns6)?e.pageX : event.clientX+ietruebody().scrollLeft;

var curY=(ns6)?e.pageY : event.clientY+ietruebody().scrollTop;

//Find out how close the mouse is to the corner of the window

var rightedge=ie&&!window.opera? ietruebody().clientWidth-event.clientX-offsetxpoint : window.innerWidth-e.clientX-offsetxpoint-20

var bottomedge=ie&&!window.opera? ietruebody().clientHeight-event.clientY-offsetypoint : window.innerHeight-e.clientY-offsetypoint-20

var leftedge=(offsetxpoint<0)? offsetxpoint*(-1) : -1000

//if the horizontal distance isn't enough to accomodate the width of the context menu

if (rightedge<tipobj.offsetWidth)

//move the horizontal position of the menu to the left by it's width

tipobj.style.left=ie? ietruebody().scrollLeft+event.clientX-tipobj.offsetWidth+"px" : window.pageXOffset+e.clientX-tipobj.offsetWidth+"px"

else if (curX<leftedge)

tipobj.style.left="5px"

else

//position the horizontal position of the menu where the mouse is positioned

tipobj.style.left=curX+offsetxpoint+"px"

//same concept with the vertical position

if (bottomedge<tipobj.offsetHeight)

tipobj.style.top=ie? ietruebody().scrollTop+event.clientY-tipobj.offsetHeight-offsetypoint+"px" : window.pageYOffset+e.clientY-tipobj.offsetHeight-offsetypoint+"px"

else

tipobj.style.top=curY+offsetypoint+"px"

tipobj.style.visibility="visible"

}

}


function hideddrivetip(){

if (ns6||ie){

enabletip=false

tipobj.style.visibility="hidden"

tipobj.style.left="-1000px"

tipobj.style.backgroundColor=''

tipobj.style.width=''

}

}
