// JavaScript Document
function doLoad_panorama(rec_start,rec_start_nav) {
    var req = new JsHttpRequest();
    req.onreadystatechange = function() {
        if (req.readyState == 4) {
			document.getElementById('dv_left').innerHTML = req.responseJS.left;
			document.getElementById('dv_right').innerHTML = req.responseJS.right;
			document.getElementById('div_0').innerHTML = req.responseText;
        }
    }
	document.getElementById('div_1').innerHTML = '<img src="images/loading.gif" width="16" height="16">';
	document.getElementById('div_2').innerHTML = '<img src="images/loading.gif" width="16" height="16">';
	document.getElementById('div_3').innerHTML = '<img src="images/loading.gif" width="16" height="16">';
	document.getElementById('div_4').innerHTML = '<img src="images/loading.gif" width="16" height="16">';
    req.open(null, 'includes/panorama_ajax.php', true);
    req.send( { rec_start: rec_start, rec_start_nav: rec_start_nav } );
}
function calendar_go(t,mm,yy) {	
	var forma  = document.getElementById(t);
	document.getElementById('month').value=mm;
	document.getElementById('year').value=yy;
	forma.submit();
}

function vote_other_visib(t) {
	if (document.f_vote.ans[t].value=="other") {
		document.getElementById('other_text').style.visibility='visible';
	} else {
		document.getElementById('other_text').style.visibility='hidden';
	}	
}
function doLoad_vote(t,other_t) {
	if(other_t==0) {
		t=t-1;
		other_text=0;		
	} else {
		other_text=document.getElementById('other_text').value;	
	}
	for (i=0; i<=t; i++) {
		if (document.f_vote.ans[i].checked==true) {
			if(document.f_vote.ans[i].value=="other") {
				value="other";
			} else {
				value=i+1;
			}
		} 
	}
    var req = new JsHttpRequest();
    req.onreadystatechange = function() {
        if (req.readyState == 4) {
			document.getElementById('d_vt4').innerHTML = req.responseJS.vote;
			//document.getElementById('d_vt4').innerHTML = req.responseText;
        }
    }
    req.open(null, 'includes/vote_ajax.php', true);
    req.send( { ans: value, other_txt: other_text } );
}
function gallery_listing(rec_start,rec_per_page4_gal,id,foto_dir,rec_start_nav) {
    var req = new JsHttpRequest();
    req.onreadystatechange = function() {
        if (req.readyState == 4) {
           document.getElementById('foto_gal').innerHTML = '<img src="photos_news'+foto_dir+'/'+req.responseJS.filename+'" width="495" height="350"/>';
		   document.getElementById('foto_gal3').innerHTML = '<font color="#FFFFFF">'+req.responseJS.foto_title+'<font>';
			document.getElementById('foto_gal2').innerHTML = req.responseText;
        }
    }
	document.getElementById('foto_gal').innerHTML = '<img src=images/loading.gif width=16 height=16><img src="images/spacer.gif" width="460" height="350"/>';
    req.open(null, 'includes/ajax_gallery.php', true);	
    req.send( { id_news: id, rec_start: rec_start, rec_per_page4_gal: rec_per_page4_gal, foto_dir: foto_dir, rec_start_nav: rec_start_nav } );
}
function make_text_size(id) {
	
	if(id==1) {		
		document.getElementById('txt1').innerHTML = '<a href="javascript:make_text_size(2)"><img src="images/minus1.gif"  width="13" height="13" hspace="5" border="0"  /></a>';		
		document.getElementById('txt2').innerHTML = '<img src="images/plus1_on.gif"  width="13" height="13" hspace="5" border="0"  />';
		document.getElementById('txt_news').className="text_big";
	}
	if(id==2) {
		document.getElementById('txt1').innerHTML = '<img src="images/minus.gif"  width="13" height="13" hspace="5" border="0"  />';
		document.getElementById('txt2').innerHTML = '<a href="javascript:make_text_size(1)"><img src="images/plus1.gif"  width="13" height="13" hspace="5" border="0"  /></a>';
		document.getElementById('txt_news').className="text_big2";
	}
}

function make_active(id,im) {
	document.getElementById(id).src=im;
}
function ad_des_go(id,ct) {
	window.location.href = "index.php?pg=nt&id="+id+"&ct="+ct; 
}
function srch_go(t) {
	var forma  = document.getElementById(t);
	forma.submit();
}

function open_wind_radio(id,w,h){
	var x=(screen.width/2)-(w/2);var y=(screen.height/2)-(h/2);
	window.open(id, 'email' ,config='left='+x+', top='+y+', height='+h+', width='+w+', scrollbars=no, resizable=no,location=no').focus(); 
}
function open_wind(id,w,h){
	var x=(screen.width/2)-(w/2);var y=(screen.height/2)-(h/2);
	window.open(id, 'email' ,config='left='+x+', top='+y+', height='+h+', width='+w+', scrollbars=yes, resizable=no,location=no').focus(); 
}

function to_basket(id,dv) {
    var req = new JsHttpRequest();
    req.onreadystatechange = function() {
        if (req.readyState == 4) {
           document.getElementById(dv).innerHTML = 'დამატებულია&nbsp;&nbsp;';
			//document.getElementById(dv).innerHTML = req.responseText;
        }
    }
	document.getElementById(dv).innerHTML = '<img src=images/loading.gif width=16 height=16>';
    req.open(null, 'includes/basket_ajax.php', true);	
    req.send( { id_bsk: id } );
}