/*
 * © IT Media Systems
 * www.itmediasys.com
 */


$(document).ready(function() {	$('#form-submit').click(function() {	  $.getJSON(self,{ajax_j: $('form').serialize()}, function(data) {
       alert(data.msg);
       if(data.status=='ok'){       	 $('#first-profile-submit').html('<p class="alert">Lūdzu autorizējaties, izmantojot Jūsu e-pasta adresi un paroli.</p>');
       }
      });      //alert($('form').serialize());
      //alert('abcd');
	});

	$(".youtube").colorbox({iframe:true, innerWidth:425, innerHeight:344});
   /*
   $('#p-email-submit').click(function() {
  	 $.getJSON(self,{ ajax: 'subscribe', p_name: $('#p-name-m').val(), p_email: $('#p-email-m').val() }, function(data) {
       alert(data.msg);
       if(data.status=='ok'){
       	 $('#p-name-m').val('');
       	 $('#p-email-m').val('');
       }
     });
  });
  */

})

function load_subc(id){	if(id=='0'){		$('#subc-sel').html('');
	}else{	 $.get(self, {ajax:'load_subc',tid:id}, function(data) {
       $('#subc-sel').html(data);
	 });
	}
}

function subc(id){	//alert(id);	$.get(self, {ajax:'tname',tid:id}, function(data) {	   $('#p_www_category_read').html(data);
	   $('#p_category_id').val(id);
	});
}

function pr(toprint,width,height){    //alert(toprint);
    var htmlcontent = '<div id="'+toprint+'" style="margin-top:15px;">'+$('#'+toprint).html()+'</div>';
    if(window.innerWidth){
		LeftPosition =(window.innerWidth-width)/2;
		TopPosition =((window.innerHeight-height)/4)-50;
			}
		else{
		LeftPosition =(parseInt(window.screen.width)-	width)/2;
		TopPosition=((parseInt(window.screen.height)-height)/2)-50;
			}
		attr = 'toolbar=0,location=0,directories=0,status=0,menubar=0,scrollbars=1,resizable=1,width=' + width + ',height=' +
		height + ',screenX=300,screenY=200,left=' + LeftPosition + ',top=' +
		TopPosition + '';

		popWin=window.open('#','', attr);
		popWin.location = window.location+'?print_pre';

    $.post('#', { ajax: "put_print_content", html: htmlcontent },function(data){
        //alert(data);

		popWin.location = window.location+'?print';
	});

	//var popbody=popWin.document.getElementsByTagName('html')[0].innerHTML;
}


