if (window != window.top) top.location.href = location.href;

var accepted_domains=new Array("www.kalale.ee","kalale.ee");
var domaincheck=document.location.href;
var accepted_ok=false;
if (domaincheck.indexOf("http")!=-1){
for (r=0;r<accepted_domains.length;r++){
if (domaincheck.indexOf(accepted_domains[r])!=-1){
accepted_ok=true
break
}
}
}
else
accepted_ok=true
if (!accepted_ok){
top.location.href="http://www.kalale.ee";
}

function kasutaja(theURL,winName,features) { window.open("/c_kasutaja.php?kasutaja="+theURL,'','scrollbars=0,menubar=0,status=0,resizable=0,width=400,height=300'); }
function saadas6brale(theURL,winName,features) { window.open("/c_saadas6brale.php?"+theURL,'','scrollbars=0,menubar=0,status=0,resizable=0,width=300,height=170'); }
function uusleht(theURL,winName,features) { window.open("/c_uusleht.php?"+theURL,'uusleht','scrollbars=1,menubar=0,status=0,resizable=0,width=460,height=460'); }
function p2evik(theURL,winName,features) { window.open("/c_uusp2evik.php?"+theURL,'','scrollbars=1,menubar=0,status=0,resizable=0,width=300,height=440'); }

function saadakiri(email) 
{
var tmp_enne = '';
var tmp_p2rast = '';
var uus_string = '';
var start = 0;
var em_hash = email.indexOf ('@');
for (count = 1; count <= em_hash; count ++)
{
tmp_enne += email.substring (start, count);
start++
}
start = em_hash;
start ++
em_hash +=2;
for (count = em_hash; count <=email.length; count++)
{
tmp_p2rast +=email.substring (start, count)
start++
}
uus_string = tmp_p2rast +'@' + tmp_enne;
parent.location = 'mailto:'+uus_string;
}


function hyppa2(targ,selObj,restore){
  eval(targ+".location='"+selObj.options[selObj.selectedIndex].value+"'");
  if (restore) selObj.selectedIndex=0;
}
function findObj(n, d) {
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=findObj(n,d.layers[i].document);
  if(!x && d.getElementById) x=d.getElementById(n); return x;
}

function hyppa(selName,targ,restore){
  var selObj = findObj(selName); if (selObj) hyppa(targ,selObj,restore);
}
function sp(url) 
{
 params  = 'width='+screen.width;
 params += ', height='+screen.height;
 params += ', top=0, left=0'
 params += ', fullscreen=yes';

 newwin=window.open('/pilt_aken_fs?id='+url,'galerii_'+url, params);
 if (window.focus) {newwin.focus()}
}

