function lightup(imgName) {
	if (document.images) {
		imgOn=eval(imgName + "on.src");
		document[imgName].src= imgOn;
	}
}

function turnoff(imgName) {
	if (document.images) {
		imgOff=eval(imgName + "off.src");
		document[imgName].src= imgOff;
	}
}

function openDetailsSheet(id) {
	if(id>0) {
//		alert(id);
		pWidth    = 850;
		pHeight   = 550;
		pToolbar  = 'N';
		pWinName  = 'PropertyDetails';
//		pFeatures = 'buttons=yes,scrollbars=yes,location=no,menubar=no,resizable=yes,status=no,directories=no';
//		f_NewWin("http://www.opiholidays.com/detail/rent_print.aspx?id="+id+"", pWidth, pHeight, pToolbar, pWinName, pFeatures);
		pFeatures = 'buttons=no,scrollbars=yes,location=yes,menubar=no,resizable=no,status=no,directories=no';
		f_NewWin("rental-details-sheet.php?id="+id+"", pWidth, pHeight, pToolbar, pWinName, pFeatures);
	} else {
		alert("Unable to open Window ID["+id+"]");
	}
}

function openAvailabilitySheet(id) {
	if(id>0) {
		pWidth    = 435;
		pHeight   = 470;
		pToolbar  = 'N';
		pWinName  = 'Availability';
		pFeatures = 'buttons=no,scrollbars=yes,location=yes,menubar=no,resizable=no,status=no,directories=no';
		f_NewWin("rental-calendar.php?id="+id+"", pWidth, pHeight, pToolbar, pWinName, pFeatures);
	} else {
		alert("Unable to open Window ID["+id+"]");
	}
}

function openSlideShowSheet(id) {
	if(id>0) {
		pWidth    = screen.width;
		pHeight   = screen.height;
		pToolbar  = 'N';
		pWinName  = 'Slideshow';
		pFeatures = 'buttons=no,scrollbars=yes,location=yes,menubar=no,resizable=no,status=no,directories=no';
		f_NewWin("slide-show.php?id="+id+"", pWidth, pHeight, pToolbar, pWinName, pFeatures);
	} else {
		alert("Unable to open Window ID["+id+"]");
	}
}

function openPrint()
{
	var a = window.open('','','scrollbars=yes,width=500,height=500');
	a.document.open("text/html");
    a.document.write("<html><head><link rel='stylesheet' href='../../_css/page.css' /></head><body>");
    a.document.write("<img src='../../images/logos/opi-logo.gif' width='240' height='125' border='0' alt='OPI Rentals - More Managed Properties. More Rentals.'  style='margin:0 0 5 0'>");
	a.document.write(document.getElementById('print-frame').innerHTML);
	a.document.write("</body></html>");
	a.document.close();
	a.print();
}

function f_NewWin(page,pWidth,pHeight,pToolbar,pWinName,pFeatures) {
	var postop = 100,posleft = 200,vFeatures = pFeatures;
	if (pToolbar=="N") vToolbar = "no"; else  vToolbar = "yes";
	if (pFeatures=="" || pFeatures==null) vFeatures = "buttons=no,scrollbars=yes,location=no,menubar=no,resizable=yes,status=no,directories=no";
	if (pWidth=="" || pWidth==null) v_width = screen.availwidth - 20;
	else {v_width = pWidth}
	if (pWinName=="" || pWinName==null) vWinName = "f_NewWin";
	else {vWinName = pWinName}
//	posleft = (screen.availwidth - v_width) / 2;
	if (pHeight=="" || pHeight==null) v_height = screen.availheight - 100;
	else {v_height = pHeight}
//	postop = (screen.availheight - v_height - 50) / 2;
	var OpenWin;
	OpenWin = this.open(page, vWinName, "top="+postop+",left="+posleft+",width=" + v_width + ",height=" + v_height + ","+vFeatures+",toolbar=" + vToolbar);
	OpenWin.focus();
}

function addbookmark(){ 
	var bookmarkurl="http://www.opiowners.com/";
	var bookmarktitle="OPI Property Management and Lettings";

	if (document.all) {
		window.external.AddFavorite(bookmarkurl,bookmarktitle)
	}
}

function printHeader(path) {
	document.write('<div id="header">');
    document.write('  <div class="bl">');
    document.write('    <h1 align="left"><a href="http://www.opirentals.com/index.php"><img src="http://www.opirentals.com/images/logos/OPI-Logo.jpg" width="200" height="125" border="0" alt="OPI Rentals" style="margin:5 0 0 0"></a></h1>');
    document.write('      <ul id="nav-center">');
    document.write('        <object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,29,0" width="300" height="60">');
    document.write('          <param name="movie" value="http://www.opirentals.com/flash/fonttrain.swf">');
    document.write('          <param name="quality" value="high">');
    document.write('          <embed src="http://www.opirentals.com/flash/fonttrain.swf" quality="high" pluginspage="http://www.macromedia.com/go/getflashplayer" type="application/x-shockwave-flash" width="300" height="60"></embed>');
    document.write('        </object>');
    document.write('      </ul>');
    document.write('      <ul id="nav-right">');
    document.write('        <li><a href="http://www.opirentals.com/index.php">Home</a> | </li>');
    document.write('        <li><a href="http://www.opirentals.com/rentals/en/climate.php">Climate</a> | </li>');
    document.write('        <li><a href="http://www.opirentals.com/rentals/en/currency-conversion.php">Currency Conversion</a> | </li>');
    document.write('        <li><a href="http://www.opirentals.com/rentals/en/it-support.php">Support</a> | </li>');
    document.write('        <li><a href="http://www.opirentals.com/rentals/en/sitemap.php">Site Map</a> | </li>');
    document.write('        <li><a href="javascript:addbookmark();">Add to <img src="http://www.opirentals.com/images/icons/favorites.gif" border="0"></a> | </li>');
    document.write('        <li><a href="http://www.opirentals.com/members/area/index.php">Login</a></li>');
    document.write('      </ul>');
    document.write('      <div id="banner-right">');
    document.write('        <a onmouseover=lightup("pic1") onmouseout=turnoff("pic1") href="http://www.opirentals.com/rentals/en/management-packages.php"><img src="http://www.opirentals.com/images/buttons/button_low_managementpackages.gif" border="0" name="pic1"></a><a onmouseover=lightup("pic5") onmouseout=turnoff("pic5") href="http://www.opirentals.com/pdf/OPI-PML-Brochure(EN).pdf" target="_blank"><img src="http://www.opirentals.com/images/buttons/button_low_brochure_en.gif" border="0" name="pic5"></a><a onmouseover=lightup("pic6") onmouseout=turnoff("pic6") href="http://www.opirentals.com/pdf/OPI-PML-Brochure(ES).pdf" target="_blank"><img src="http://www.opirentals.com/images/buttons/button_low_brochure_es.gif" border="0" name="pic6"></a><a onmouseover=lightup("pic3") onmouseout=turnoff("pic3") href="http://www.opifranchise.com/" target="_blank"><img src="http://www.opirentals.com/images/buttons/button_low_franchise.gif" border="0" name="pic3"></a>');
    document.write('      </div>');
    document.write('  </div>');
    document.write('</div>');
}

function printFooter(path) {
    document.write('<div class="container">');
    document.write('  <div class="or_head">');
    document.write('    Copyright &copy; 2009 Overseas Property Investments, Your Property Management and Lettings Specialist<br>');
    document.write('    Call us Monday - Friday 10 AM - 6 PM on 0034.966.790.257<br>');
    document.write('    or E-Mail us on <a href="mailto:info@opirentals.com"><span class="whitefont">info@opirentals.com</span></a>');
    document.write('  </div>');
    document.write('  <p>');
    document.write('    <FORM method="GET" action="http://www.google.com/search" target="_blank">');
    document.write('      <div>');
    document.write('        <A HREF="http://www.google.com" target="_blank">');
    document.write('          <IMG SRC="http://www.opirentals.com/images/logos/Logo_40wht.gif" border="0" ALT="Google" align="absmiddle">');
    document.write('        </A>');
    document.write('        <INPUT TYPE="text" name="q" size="31" maxlength="255" value="">');
    document.write('        <INPUT TYPE="hidden" name="hl" value="com">');
    document.write('        <INPUT type="submit" name="btnG" VALUE="Google Search">');
    document.write('      </div>');
    document.write('    </FORM>');
    document.write('  </p>');
    document.write('</div>');
    document.write('<div class="container">');
    document.write('  <div class="or_head">About Us</div>');
    document.write('  <div class="or_body">');
    document.write('    Our Organisation |');
    document.write('    <a href="http://www.opirentals.com/rentals/en/history.php">History</a> |');
    document.write('    <a href="http://www.opirentals.com/rentals/en/offices.php">Offices</a> |');
    document.write('    What we do |');
    document.write('    <a href="http://www.opirentals.com/rentals/en/property-management.php">Property Management</a> |');
    document.write('    <a href="http://www.opirentals.com/rentals/en/letting-promotion.php">Letting Promotion</a> |');
    document.write('    <a href="http://www.opirentals.com/rentals/en/industry-advisors.php">Industry Advisors</a> |');
    document.write('    <a href="http://www.opirentals.com/rentals/en/resort-management.php">Resort Management</a> |');
    document.write('    <a href="http://www.opirentals.com/rentals/en/customer-charter.php">Customer Charter</a>');
    document.write('  </div>');
    document.write('  <div class="or_head">Property Management</div>');
    document.write('  <div class="or_body">');
    document.write('    Management Service |');
    document.write('    <a href="http://www.opirentals.com/rentals/en/holiday-homes.php">Holiday Homes</a> |');
    document.write('    <a href="http://www.opirentals.com/rentals/en/resort-management.php">Resort Management</a> |');
    document.write('    <a href="http://www.opirentals.com/rentals/en/renting-out-your-property.php">Renting Out Your Property</a> |');
    document.write('    <a href="http://www.opirentals.com/rentals/en/insurance.php">Insurance</a> |');
    document.write('    Services |');
    document.write('    <a href="http://www.opirentals.com/rentals/en/cleaning-services.php">Cleaning Services</a> |');
    document.write('    <a href="http://www.opirentals.com/rentals/en/departure-clean.php">Departure Clean</a> |');
    document.write('    <a href="http://www.opirentals.com/rentals/en/builders-clean.php">Builders Clean</a> |');
    document.write('    <a href="http://www.opirentals.com/rentals/en/spring-clean.php">Spring Clean</a> |');
    document.write('    <a href="http://www.opirentals.com/rentals/en/home-services.php">Home Services</a> |');
    document.write('    <a href="http://www.opirentals.com/rentals/en/additional-services.php">Additional Services</a> |');
    document.write('    Maintenance |');
    document.write('    <a href="http://www.opirentals.com/rentals/en/general-maintenance.php">General Maintenance</a> |');
    document.write('    <a href="http://www.opirentals.com/rentals/en/security-products.php">Safety / Security Products</a> |');
    document.write('    <a href="http://www.opirentals.com/rentals/en/garden-pool-maintenance.php">Garden / Pool Maintenance</a> |');
    document.write('    <a href="http://www.opirentals.com/rentals/en/management-packages.php">Management Packages</a> |');
    document.write('    <a href="http://www.opirentals.com/rentals/en/testimonials.php">Testimonials</a> |');
    document.write('    <a href="http://www.opirentals.com/rentals/en/dos-donts.php">Do&acute;s and Dont&acute;s</a> |');
    document.write('    <a href="http://www.opirentals.com/rentals/en/faqs.php">FAQ</a>');
    document.write('  </div>');
    document.write('  <div class="or_head">Affiliates</div>');
    document.write('  <div class="or_body">');
    document.write('    <a href="http://www.opirentals.com/rentals/en/affiliates.php">Affiliates</a>');
    document.write('  </div>');
    document.write('  <div class="or_head">Contact Us</div>');
    document.write('  <div class="or_body">');
    document.write('    Headquarters |');
    document.write('    <a href="http://www.opirentals.com/rentals/en/pm-enquiries.php">Property Management</a> |');
    document.write('    <a href="http://www.opirentals.com/rentals/en/it-enquiries.php">IT Support</a> |');
    document.write('    <a href="http://www.opirentals.com/rentals/en/franchise-enquiries.php">Franchise Enquiries</a> |');
    document.write('    <a href="http://www.opirentals.com/rentals/en/web-comments.php">Web Comments</a> |');
    document.write('    <a href="http://www.opirentals.com/rentals/en/office-network.php">Office Network</a>');
    document.write('  </div>');
    document.write('</div>');
}

// disable Right-Click

var popup = "Copyright Overseas Property Investments";

function noway(go) {
  if(document.all) {
    if (event.button == 2) {
      alert(popup);
      return false;
	}
  }
  
  if (document.layers) {
    if (go.which == 3) {
      alert(popup);
	  return false;
	}
  }
}

if (document.layers) 
{ document.captureEvents(Event.MOUSEDOWN); } 

document.onmousedown=noway;
document.onkeydown=noControl;

function noControl(evt) {
  var evt  = (evt) ? evt : ((event) ? event : null);
  var node = (evt.target) ? evt.target : ((evt.srcElement) ? evt.srcElement : null);
  
  // current pressed key
  var pressedKey = String.fromCharCode(event.keyCode).toLowerCase();

  if (evt.ctrlKey && pressedKey == "c") {
    window.event.cancelBubble = true;
    window.event.returnValue = false;
    alert(popup);
    return false;
  }
}

function printOurOffices(selectedOffice) {
  document.write('<select name="opi_offices" class="pagedata" onChange="changeOffice(this.form.opi_offices.options[selectedIndex].text);">');

  if(selectedOffice=="Headquarters") {
    document.write('<option selected>Headquarters</option>');
  } else {
    document.write('<option>Headquarters</option>');
  }

  document.write('<option>------------------------------</option>');

  document.write('<option style="background-color:#DBEAF5">[Costa Blanca North]</option>');

  if(selectedOffice=="Alfaz del Pi") {
    document.write('<option selected>Alfaz del Pi</option>');
  } else {
    document.write('<option>Alfaz del Pi</option>');
  }

  document.write('<option style="background-color:#DBEAF5">[Costa-Blanca-South]</option>');

  if(selectedOffice=="Algorfa") {
    document.write('<option selected>Algorfa</option>');
  } else {
    document.write('<option>Algorfa</option>');
  }

  if(selectedOffice=="Ciudad Quesada") {
    document.write('<option selected>Ciudad Quesada</option>');
  } else {
    document.write('<option>Ciudad Quesada</option>');
  }

  if(selectedOffice=="Gran Alacant") {
    document.write('<option selected>Gran Alacant</option>');
  } else {
    document.write('<option>Gran Alacant</option>');
  }

  if(selectedOffice=="La Marina") {
    document.write('<option selected>La Marina</option>');
  } else {
    document.write('<option>La Marina</option>');
  }

  document.write('<option style="background-color:#DBEAF5">[Costa-Tropical]</option>');

  if(selectedOffice=="Granada") {
    document.write('<option selected>Granada</option>');
  } else {
    document.write('<option>Granada</option>');
  }

document.write('</select>');
}

function changeOffice(office) {
	if(office == "Alfaz del Pi") {
		openLink('opi-alfaz.php','_self');
	}
	else if(office == "Algorfa") {
		openLink('opi-algorfa.php','_self');
	}
	else if(office == "Ciudad Quesada") {
		openLink('opi-ciudad-quesada.php','_self');
	}
	else if(office == "Gran Alacant") {
		openLink('opi-gran-alacant.php','_self');
	}
	else if(office == "La Marina") {
		openLink('opi-la-marina.php','_self');
	}
	else if(office == "Granada") {
		openLink('opi-granada.php','_self');
	}
	else {
		openLink('opi-head-quarter.php','_self');
	}
}

function openLink(page, title) {
    win = window.open(page, title);
}

function doPrint()
{
	alert("Hiding Print-Button during print! Reload Page to visualize Print-Button.");
	document.all.printline.style.display="none";
	window.print();
}

function dame_correo(){
  var user="info@";
  var domain="opirentals.com";
  var connector="@";

  return user + conector + domain;
}

function escribe_enlace_correo(){
   document.write("<a href='mailto:" + dame_correo() + "'>" + dame_correo() + "</a>");
}
