var console = { info: function(i){ alert(i); } }

$(document).ready(function(){
	$('input[@type=text]').focus(function(){
		if ($(this)[0].name == 'q' && $(this)[0].value == $(this)[0].defaultValue) $(this)[0].value = ''
	})
		$('input[@type=text]').blur(function(){
		if ($(this)[0].name == 'q' && $(this)[0].value == '') $(this)[0].value = $(this)[0].defaultValue
	})
	$('#home').click(function(){ window.open('#', '_self') })
})

function show_block(id,status) {
	if (document.getElementById && document.getElementById(id)) {
		if (status!=undefined) {
			document.getElementById(id).style.display = (status == false) ? 'none' : 'block';
		} else {
			var current_status = document.getElementById(id).style.display;
			document.getElementById(id).style.display = (current_status == "block") ? "none" : "block";
		}
		return false;
	}
}

function /*object*/ getLayerRef(/* String*/ id, /*String [optional]*/ document) {
    if(!document)
        document = window.document;

    if (document.all) {
        return document.all[id];
    }
    else if (document.getElementById) {
        return document.getElementById(id);
    }
}

function loadFrame(id,source){
   frameObj = getLayerRef(id)
   if(frameObj){
       frameObj.src = source;
   }
}

// form popup images
function showFull(immage,hheight,wwidth){

  document.getElementById('cover').style.display='block';
  document.getElementById('cover').style.position='absolute';
  document.getElementById('cover').style.top=0;

  if( typeof( window.innerWidth ) == 'number' ) {
    //Non-IE
    lefty = window.innerWidth;
    toppy = window.innerHeight;
  } else if( document.documentElement && ( document.documentElement.clientWidth || document.documentElement.clientHeight ) ) {
    //IE 6+ in 'standards compliant mode'
    lefty = document.documentElement.clientWidth;
    toppy = document.documentElement.clientHeight;
  } else if( document.body && ( document.body.clientWidth || document.body.clientHeight ) ) {
    //IE 4 compatible
    lefty = document.body.clientWidth;
    toppy = document.body.clientHeight;
  }

        //lefty=document.body.clientWidth;
    var lef=Math.round((lefty/2 )-(wwidth/2)-10);
    //  toppy=document.body.clientHeight;
    var topp=Math.round((toppy/2)-(hheight/2)-10);
        document.getElementById('cover').style.left=0;
        document.getElementById('cover').style.zIndex=900;
        document.getElementById('cover').style.backgroundImage='url(http://www.norvik.lv/img/popup/overlay.png)';
        document.getElementById('cover').style.width='100%';
        document.getElementById('cover').style.height='2000px';
        document.getElementById('framer').style.display='block';
        document.getElementById('framer').style.position='absolute';
        document.getElementById('framer').style.top=topp+'px';
        document.getElementById('framer').style.left=lef+'px';
//		alert('<img src="'+immage+'" width="'+wwidth+'" height="'+hheight+'" border="0" onclick="hideFull()"/><img src="close.gif" style="right: -6px; top: -6px; position: absolute; z-index: 110;" onclick="hideFull()" />');
		document.getElementById('framer').innerHTML='<img src="http://www.norvik.lv'+immage+'" width="'+wwidth+'" height="'+hheight+'" border="0" onclick="hideFull()"/><img src="http://www.norvik.lv/img/popup/close.gif" style="right: -6px; top: -6px; position: absolute; z-index: 110;" onclick="hideFull()" />';
		document.getElementById('framer').style.zIndex=1000;
}
function hideFull(){
  document.getElementById('cover').style.display='none';
  document.getElementById('framer').innerHTML='';
  document.getElementById('framer').style.display='none';
}

