function montre(id) {
var d = document.getElementById(id);
	
		document.getElementById('smenu3').style.display='none';
	
if (d) {d.style.display='block';}
}

function showtext(thetext) {
if (!document.getElementById)
return
document.getElementById("karte").innerHTML=thetext;
}

function hidetext(){
document.getElementById("karte").innerHTML="";
}

function resize(x) {
  var myWidth = 0, myHeight = 0;
  if( typeof( window.innerWidth ) == 'number' ) {
    //Non-IE
    myWidth = window.innerWidth;
    myHeight = window.innerHeight;
  } else if( document.documentElement && ( document.documentElement.clientWidth || document.documentElement.clientHeight ) ) {
    //IE 6+ in 'standards compliant mode'
  //  myWidth = document.documentElement.clientWidth;
   // myHeight = document.documentElement.clientHeight;
    
  } else if( document.body && ( document.body.clientWidth || document.body.clientHeight ) ) {
    //IE 4 compatible
    myWidth = document.body.clientWidth;
    myHeight = document.body.clientHeight;
  }
  myHeight=document.documentElement.scrollHeight ;
   myWidth=document.documentElement.clientWidth; ;
    myHeight=document.body.scrollHeight ;
     myHeight1 = document.body.clientHeight;
     if ( myHeight1>myHeight) myHeight=myHeight1;
    myWidth=document.body.clientWidth;
  // myWidth=myWidth-25;
 // myHeight=myHeight-10;
// height_mala=document.getElementById("mala").style.height; 
 //window.alert( 'Width = ' + height_mala );
  wheight=myHeight-x;
 // wheight=myHeight-height_mala;
 var apaksa = document.getElementById("apaksa"); 
    var viss = document.getElementById("viss"); 
        viss.style.height = myHeight+ "px";
     
    viss.style.width =  myWidth+ "px";
     if (wheight>0)
   apaksa.style.height = wheight + "px"; 
 
 //window.alert( 'Width = ' + myWidth );
 
  //window.alert( 'vidus Height = ' + height_vidus );
  // window.alert( 'vidus scroll = ' + height_scroll );
}


function resize2(x) {
  var myWidth = 0, myHeight = 0;
  if( typeof( window.innerWidth ) == 'number' ) {
    //Non-IE
    myWidth = window.innerWidth;
    myHeight = window.innerHeight;
  } else if( document.documentElement && ( document.documentElement.clientWidth || document.documentElement.clientHeight ) ) {
    //IE 6+ in 'standards compliant mode'
  //  myWidth = document.documentElement.clientWidth;
   // myHeight = document.documentElement.clientHeight;
    
  } else if( document.body && ( document.body.clientWidth || document.body.clientHeight ) ) {
    //IE 4 compatible
    myWidth = document.body.clientWidth;
    myHeight = document.body.clientHeight;
  }
  myHeight=document.documentElement.scrollHeight ;
   myWidth=document.documentElement.scrollWidth ;
  wheight=myHeight-x;
 var frame = document.getElementById("apaksa"); 
    var viss = document.getElementById("viss"); 
     viss.style.height = myHeight+ "px";
     viss.style.width =  myWidth+ "px";
     if (wheight>0)
    frame.style.height = wheight + "px"; 
 
  //window.alert( 'Width = ' + myWidth );
 // window.alert( 'Height = ' + myHeight );
  //window.alert( 'vidus Height = ' + height_vidus );
  // window.alert( 'vidus scroll = ' + height_scroll );
}


function vaihto(kurs) {

var browserName=navigator.appName; 
//document.getElementById('viss').style.background='url(images/fons.jpg) no-repeat';
document.getElementById('mala').style.background='url(images/mala.jpg) no-repeat';
document.getElementById('augsa').style.background='url(images/Dizains.jpg) no-repeat';
//document.getElementById('viss').style.background='url('+kurs+') no-repeat'; 
if (browserName=="Netscape")
{ 
//document.getElementById('viss').style.background='url(images/fons.jpg) no-repeat';
document.body.style.background='url(images/fons.jpg) no-repeat';
}
else {
setTimeout("document.getElementById('viss').style.background='url("+kurs+") no-repeat'; document.getElementById('viss').style.filter='revealtrans(duration=20.0,Transition=6)';document.getElementById('viss').filters[0].Apply();  document.getElementById('viss').filters[0].Play();", 30);
}
}

function resize1(x){ 
if (document.all) {
   wheight = document.body.offsetHeight-x;
   width=document.body.offsetWidth-30;
   height=document.body.offsetHeight-30;
   height_vidus=document.getElementById("vidus").offsetHeight;
   wheight_vidus=document.getElementById("vidus").offsetHeight-330;
   if (wheight<wheight_vidus) wheight=wheight_vidus;
   if (height<height_vidus) height=height_vidus;
   
   }
   var frame = document.getElementById("apaksa"); 
    var viss = document.getElementById("viss"); 
     viss.style.height = height+ "px";
     viss.style.width = width+ "px";
   if (wheight>0)
    frame.style.height = wheight + "px"; 
   // frame.style.height = "100%";
    //viss.style.height = "100%";
    
  //  var s=getPagesize();
    //wheight=s[1]-x;
    //frame.style.height = wheight + "px"; 
    
    
 }

function insertcode(tag, desc)
{   
    // our textfield
    var textarea = document.getElementById("teksts");
    
    // our open tag
    var open = "<" + tag + ">";
 
    // our close tag
    var close = "</" + tag + ">";
 
    if(!textarea.setSelectionRange)
    {
        var selected = document.selection.createRange().text; 
        if(selected.length <= 0)
        { 
            // no text was selected so prompt the user for some text
            textarea.value += open + prompt("Please enter the text you'd like to " + desc, "") + close;
        }
        else
        {
            // put the code around the selected text
            document.selection.createRange().text = open + selected + close; 
        }
 
    }
    else
    {
        // the text before the selection
        var pretext = textarea.value.substring(0, textarea.selectionStart);
      
        // the selected text with tags before and after
        var codetext = open + textarea.value.substring(textarea.selectionStart, textarea.selectionEnd) + close;
 
        // the text after the selection
        var posttext = textarea.value.substring(textarea.selectionEnd, textarea.value.length)
        
        // check if there was a selection
        if(codetext == open + close)
        {
            //prompt the user
            codetext = open + prompt("Please enter the text you'd like to " + desc, "") + close;
        }
 
        // update the text field
        textarea.value = pretext + codetext + posttext;
    }
 
    // set the focus on the text field
    textarea.focus();
}
 
// inserts an image by prompting the user for the url

function atjaunot()
{
//document.edit.teksts.value=<?=$buffer_back?>;
document.edit.teksts.value=document.edit.teksts_back.value;
document.edit.teksts_old.value=document.edit.teksts_back.value;
}
function insertimage()
{
    // our textfield
    var textarea = document.getElementById("The_TextArea");
 
    // our image
   // var image = "<img src='" + prompt("Please enter the url", "http://") + "' alt="" />";
 
    if(!textarea.setSelectionRange)
    {
        // get selected text
        var selected = document.selection.createRange().text; 
 
        if(selected.length <= 0)
        { 
            // no text was selected so add the image to the end
            textarea.value += image;
        }
        else
        {
            // replace the selection with the image
            document.selection.createRange().text = image; 
        }
    }
    else
    {
        // the text before the selection
        var pretext = textarea.value.substring(0, textarea.selectionStart);
 
        // the text after the selection
        var posttext = textarea.value.substring(textarea.selectionEnd, textarea.value.length)
 
        // update the text field
        textarea.value = pretext + image + posttext;
    }
 
    // set the focus on the text field
    textarea.focus();
}
 
// inserts a link by prompting the user for a url
function insertlink()
{
    // our textfield
    var textarea = document.getElementById("The_TextArea");
 
    // our link
    var url = prompt("Please enter the url", "http://");
    var link = "[url=" + url + ">" + url + "[/url]";
 
    if(!textarea.setSelectionRange)
    {
        // get selected text
        var selected = document.selection.createRange().text; 
 
        if(selected.length <= 0)
        { 
            // no text was selected so add the link to the end
            textarea.value += link;
        }
        else
        {
            // replace the selection with the link
            document.selection.createRange().text = link; 
        }
    }
    else
    {
        // the text before the selection
        var pretext = textarea.value.substring(0, textarea.selectionStart);
 
        // the text after the selection
        var posttext = textarea.value.substring(textarea.selectionEnd, textarea.value.length)
 
        // update the text field
        textarea.value = pretext + link + posttext;
    }
 
    // set the focus on the text field
    textarea.focus();
}

