function popupOpen(popupUrl,popupWidth,popupHeight){
	window.open(popupUrl,"popup","toolbar=no,height="+popupHeight+",width="+popupWidth+",location=no,directories=no,status=no,menubar=no,scrollbars=yes,resizable=yes");
}

function clearSearchField() {
	if($('.searchText').val() == 'Search' || $('.searchText').val() == 'Sök' || $('.searchText').val() == 'Hae') {
		$('.searchText').val('');
	}
}

var idPop = 0;

 
  $(document).ready(function() {
  
	$('.redBox .content').css('width', $('.redBox .content').width() - 43 + 'px');
	$('.redBox .col2').css('width', $('.redBox .col2').width() - 43 + 'px');
	$('.redBox .filler').css('height', $('.redBox .content').height() - 43 + 'px');
	
	var rounded = RUZEE.ShadedBorder.create({ corner:8 });
    rounded.render($('.rounded'));
    
    var roundedBorder = RUZEE.ShadedBorder.create({ corner:8, border:1 });
    roundedBorder.render($('.roundedBorder'));
    
    var roundedBottomBorder = RUZEE.ShadedBorder.create({ corner:8, border:1, edges:"blr" });
    roundedBottomBorder.render($('.roundedBottomBorder'));
    
    var roundedTopBorder = RUZEE.ShadedBorder.create({ corner:8, border:1, edges:"tlr" });
    roundedTopBorder.render($('.roundedTopBorder'));
    
    var roundedTopBorderThick = RUZEE.ShadedBorder.create({ corner:8, border:4, edges:"tlr" });
    roundedTopBorderThick.render($('.roundedTopBorderThick'));
    
    var roundedTopRight = RUZEE.ShadedBorder.create({ corner:8, edges:"tr" });
    roundedTopRight.render($('.roundedTopRight'));
    
    var roundedBottom = RUZEE.ShadedBorder.create({ corner:8, edges:"blr" });
    roundedBottom.render($('.roundedBottom'));
    
    var roundedTop = RUZEE.ShadedBorder.create({ corner:8, edges:"tlr" });
    roundedTop.render($('.roundedTop'));
    
    var popUpDivCloseBtn = RUZEE.ShadedBorder.create({ corner:8, border:1, edges:"tlr" });
    popUpDivCloseBtn.render($('.closeBtn'));
    
    var popUpDivTextArea = RUZEE.ShadedBorder.create({ corner:8, border:1, edges:"tbl" });
    popUpDivTextArea.render($('.textArea'));
    
    
	
  
   $("a.contactFi").click(function() {
     javascript:popupOpen('http://finnvera.fi/index.cfm?mod=puhlu2&id=1&stype=normal',660,600)
   });
   $("a.feedbackFi").click(function() {
     javascript:popupOpen('http://finnvera.fi/popup_palaute.cfm?id=1',560,600)
   });
   $("a.sitemapFi").click(function() {
     javascript:popupOpen('http://finnvera.fi/index.cfm?mod=sitemap&id=1',560,600)
   });
   $("a.literatureFi").click(function() {
     javascript:popupOpen('http://finnvera.fi/index.cfm?mod=glossary&id=1',560,600)
   });
   $("a.contactEng").click(function() {
     javascript:popupOpen('http://finnvera.fi/index.cfm?mod=puhlu2&id=3&stype=normal',660,600)
   });
   $("a.feedbackEng").click(function() {
     javascript:popupOpen('http://finnvera.fi/popup_palaute.cfm?id=3',560,600)
   });
   $("a.sitemapEng").click(function() {
     javascript:popupOpen('http://finnvera.fi/index.cfm?mod=sitemap&id=3',560,600)
   });
   $("a.contactSwe").click(function() {
     javascript:popupOpen('http://finnvera.fi/index.cfm?mod=puhlu2&id=2&stype=normal',660,600)
   });
   $("a.feedbackSwe").click(function() {
     javascript:popupOpen('http://finnvera.fi/popup_palaute.cfm?id=2',560,600)
   });
   $("a.sitemapSwe").click(function() {
     javascript:popupOpen('http://finnvera.fi/index.cfm?mod=sitemap&id=2',560,600)
   });
   $("a.literatureSwe").click(function() {
     javascript:popupOpen('http://finnvera.fi/index.cfm?mod=glossary&id=2',560,600)
   });
   $("a.useOnlineServiceFi").click(function() {
     window.open(this.href); return false;
   });

   $("a.popup").click(function(){

	var dims = this.getAttribute('title').split("x");

	if(dims[0] && dims[1]){
		popupOpen(this.href,dims[0],dims[1]);
		return false;
	}


   });

 
 
 /* Bottombar */
   $("a.legalFi").click(function() {
     javascript:popupOpen('http://finnvera.fi/index.cfm?id=1201',650,500);
   });
   	$("a.coopFi").click(function() {
     javascript:popupOpen('http://finnvera.fi/index.cfm?id=1202',650,500);
   });
   $("a.legalEng").click(function() {
     javascript:popupOpen('http://finnvera.fi/index.cfm?id=1205',650,500);
   });
   $("a.legalSwe").click(function() {
     javascript:popupOpen('http://finnvera.fi/index.cfm?id=1203',650,500);
   });
   $("a.coopEng").click(function() {
     javascript:popupOpen('http://finnvera.fi/index.cfm?id=1206',650,500);
   });
   $("a.coopSwe").click(function() {
     javascript:popupOpen('http://finnvera.fi/index.cfm?id=1204',650,500);
   });
   $("a.print").click(function() {
     javascript:window.print();
   });
   /*misc */
   $("a.blank").click(function() {
     window.open(this.href); return false;
   });
   /*popupdivbar */
   $(".popUpDivWrapper a.popToggle").click(function () {
		idPop = $(this).attr('id');
		$('#pop' + idPop).hide();
    });
	$(".pageContainer a.popToggle").click(function () {
		$("div[id^='pop']").hide();
		var idPop = $(this).attr('id');
		$('#pop' + idPop).show();
    });

	$("body").append('<div id="bottombar">&nbsp;</div>');

 });
/* Basicly this works like this:

One (You, somebody, me) put's a this kind of div in the site:

<div class="popUpDivWrapper" id="pop112">
	<div class="closeBtn">
		<a class="popToggle" id="112" href="#pop112"><img src="images/button_sulje_off.gif" alt="close" /></a>
	</div>
	<div class="textArea">
		<b>Yrittäjälaina</b>
		<p>
			Yrittäjälaina on tarkoitettu uuden yrityksen perustamiseen, jo toimivan yrityksen osakkeiden tai yhtiömiesosuuksien ostamiseen sukupolvenvaihtotilanteissa tai osakekaupoissa sekä toimivan yrityksen osakepääoman korotukseen. Laina käytetään kokonaisuudessaan osakepääomaan tai yhtiöpanokseksi.<br />
			<br />
			Yrityslainaa saava yritys voi toimia muilla toimialoilla mutta ei varsinaisessa maatilataloudessa, metsätaloudessa eikä rakennusliiketoiminnan perustajaurakoinnissa.<br />
			<br />
			Yrittäjälainaa hakevan on oltava osakeyhtiön osakas, jonka osuus osakepääomasta ja äänivallasta on vähintään 20 %, avoimen yhtiön yhtiömies tai kommandiittiyhtiön vastuunalainen yhtiömies. Hakijan tulee osallistua yrityksen toimintaan täysipäiväisellä työpanoksella ja saada toimeentulonsa yrityksestä.
			<br />
			Laina on yrittäjän henkilökohtainen laina. Se voidaan myöntää myös usealle saman yrityksen perustajalle tai osakkaalle.
		</p>
	</div>
</div>
-------
<a class="popToggle" id="11" href="#pop11">POPUP</a>
-------

Prefixes are:
1: <a> that opens the popup has class popToglle and a id that is same in the popup wanted to open i.e 11.
2: PopupDiv has the same id as above i.e 11 with "pop" in front of it i.e pop11.

*/
