
// popup window

var win=null;
function NewWindow(mypage,myname,w,h,scroll,pos){
if(pos=="random"){LeftPosition=(screen.width)?Math.floor(Math.random()*(screen.width-w)):100;TopPosition=(screen.height)?Math.floor(Math.random()*((screen.height-h)-75)):100;}
if(pos=="center"){LeftPosition=(screen.width)?(screen.width-w)/2:100;TopPosition=(screen.height)?(screen.height-h)/2:100;}
else if((pos!="center" && pos!="random") || pos==null){LeftPosition=0;TopPosition=20}
settings='width='+w+',height='+h+',top='+TopPosition+',left='+LeftPosition+',scrollbars='+scroll+',location=no,directories=no,status=no,menubar=no,toolbar=no,resizable=yes';
myWindow=window.open(mypage,myname,settings);

if (myWindow.closed) {
myWindow=window.open(mypage,myname,settings);
myWindow.document.bgColor="black";}
else {
myWindow.close();
myWindow=window.open(mypage,myname,settings);
myWindow.document.bgColor="black";}}


function showTable(ID) {
            document.getElementById('t'+ID).style.display = "";
}
function hideTable(ID) {
            document.getElementById('t'+ID).style.display = "none";
}
function chTable(ID) {
        if (document.getElementById('t'+ID).style.display == "") {
            document.getElementById('t'+ID).style.display = "none";
       } else {
           document.getElementById('t'+ID).style.display = "";
        }
}

var maxLen=800;
function maxComentChar(form, tekst) {
   str = document.forms[form].elements[tekst].value;
	   len = str.length;
   if ( len > maxLen ) {document.forms[form].elements[tekst].value = str.substring(0,maxLen);
   alert('Upisali ste '+maxLen+' karaktera.');}
{     document.forms[form].elements[tekst].focus();
   document.forms[form].mc.value = (maxLen - document.forms[form].elements[tekst].value.length);
 }
} 

function ocenaUsluga(ocena) {
	document.getElementById('ocena_usluga_html').innerHTML='usluga: ' + ocena; 
	document.getElementById('ocena_usluga').value=ocena; 
}
function ocenaCena(ocena) {
	document.getElementById('ocena_cena_html').innerHTML='cene: ' + ocena; 
	document.getElementById('ocena_cena').value=ocena; 
}


function fbs_click() {
u=location.href;
t=document.title;window.open('http://www.facebook.com/sharer.php?u='+encodeURIComponent(u)+'&t='+encodeURIComponent(t),'sharer','toolbar=0,status=0,width=626,height=436');
return false;
}

function space_click() {
u=location.href;
t=document.title;
window.open('http://www.myspace.com/Modules/PostTo/Pages/?t='+encodeURIComponent(t)+'&c='+encodeURIComponent(u)+'&l=1','sharer','toolbar=0,status=0,width=626,height=436');
return false;
}

function twitter_click() {
u=location.href;
t=document.title;
window.open('http://twitter.com/home?status='+encodeURIComponent(t)+'%20'+encodeURIComponent(u),'sharer','toolbar=0,status=0,width=800,height=600');
return false;
}



//function GetThis(T, C, U, L)
//{
//    var targetUrl = 'http://www.myspace.com/index.cfm?fuseaction=postto&' + 't=' + encodeURIComponent(document.title)
//    + '&c=' + encodeURIComponent(C) + '&u=' + encodeURIComponent(location.href) + '&l=' + L;
//    window.open(targetUrl);
//}

//<a href="javascript:GetThis('MySpace Post To Feature Example', '<p>HTML content to post goes here <i>(e.g. text, images, objects, etc.)</i></p>', 'http://www.myspace.com', 3)">
//    <img src="http://cms.myspacecdn.com/cms/post_myspace_icon.gif" border="0" alt="Post to MySpace!" /> Share on MySpace!
//</a>
