﻿function InformPlaylist(){
		SoditajiPub.inform.openConf("Lai lietotu personizēto atskaņošanas sarakstu jābūt atļautiem sīkfailiem(cookies).<br> <b>Vai vēlies lietot personizēto atskaņošanas sarakstu?</b>","SoditajiPub.playlist.setUserPlaylist('pp');","")
	}
function InformPlaylist2(){
		SoditajiPub.inform.openConf("Ja pārslēgsities uz standarta atskaņošanas sarakstu, Jūsu personizētais atskaņošanas saraksts tiks dzēsts.<br> <b>Vai vēlies lietot standarta atskaņošanas sarakstu?</b>","SoditajiPub.playlist.setUserPlaylist('ps');","")
	}
SoditajiPub.inform = {
	msg : "none",
	okFunc : "return false;",
	noFunc : "retun false;",
//	defImg : "";
    getScreenPropertie : function (need){
		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;
		}
		if(need == 'height'){
		  	return  myHeight;
		} else if (need == 'width'){
		  	return myWidth;
		}
	},

    createDivConf : function(){
    var margin_top = (this.getScreenPropertie('height') - 120)/2;
    $("body").append("<div id='infBody'><table align='center' cellpadding='0' cellspacing='0' class='gal_table' style='margin-top:"+margin_top+"px;'>"+
		"<tr>"+
		"	<td class='s_fig_1'>&nbsp;</td>"+
		"	<td class='s_fig_8'>&nbsp;</td>"+
		"	<td class='s_fig_7'>&nbsp;</td>"+
		"</tr>"+
		"<tr>"+
		"	<td class='s_fig_2'>&nbsp;</td>"+
		"	<td align='justify' class='s_fig_9'><br>"+this.msg+"<br><br><br><button class='infBt' onclick=\""+this.okFunc+"SoditajiPub.inform.closeInfBox();\">Jā</button>&nbsp; &nbsp;&nbsp; &nbsp; &nbsp;<button class='infBt' onclick=\""+this.noFunc+"SoditajiPub.inform.closeInfBox();\">Nē</button></td>"+
		"	<td class='s_fig_6'>&nbsp;</td>"+
		"</tr>"+
		"<tr>"+
		"	<td class='s_fig_3'>&nbsp;</td>"+
		"	<td class='s_fig_4'>&nbsp;</td>"+
		"	<td class='s_fig_5'>&nbsp;</td>"+
		"</tr>"+
	"</table></div>");
    },
    createDivErr : function(){
    var margin_top = (this.getScreenPropertie('height') - 100)/2;
    $("body").append("<div id='infBody'><table align='center' cellpadding='0' cellspacing='0' class='gal_table' style='margin-top:"+margin_top+"px;'>"+
		"<tr>"+
		"	<td class='s_fig_1'>&nbsp;</td>"+
		"	<td class='s_fig_8'>&nbsp;</td>"+
		"	<td class='s_fig_7'>&nbsp;</td>"+
		"</tr>"+
		"<tr>"+
		"	<td class='s_fig_2'>&nbsp;</td>"+
		"	<td align='justify' class='s_fig_9'>"+this.msg+"<br><button class='infBt' onclick=\""+this.okFunc+"SoditajiPub.inform.closeInfBox();\">Labi</button></td>"+
		"	<td class='s_fig_6'>&nbsp;</td>"+
		"</tr>"+
		"<tr>"+
		"	<td class='s_fig_3'>&nbsp;</td>"+
		"	<td class='s_fig_4'>&nbsp;</td>"+
		"	<td class='s_fig_5'>&nbsp;</td>"+
		"</tr>"+
	"</table></div>");
    },
    openConf : function(m,of,nf){
    	this.msg = m;
    	this.okFunc = of;
    	this.noFunc = nf;
    	this.createDivConf();
  	},
	openErr : function(m,of){
    	this.msg = m;
    	if(of){
    		this.okFunc = of;
    	}
    	this.createDivErr();
  	},
  	closeInfBox : function (){
  		$('#infBody').html('');
  		$('#infBody').remove();
  	}
}

SoditajiPub.userProfBox = {
	user:'',
 closeBox : function (){
  		$('#close_msg').remove();
  		$('#picBody').html('');
  		$('#picBody').remove();
  	},
	startBoxing : function() {
		 this.showProf();       
    },
    getAttrValue : function(attrName){
		return $(this.image).attr(attrName);
	},
    showProf : function(){
    var x = this.getScreenPropertie('width')-70;
    var y = this.getScreenPropertie('height')-100;
    	nIW = 600;
    	nIH = 500;

    	var vidId = this.getAttrValue('exVidId');
    	iH = Math.abs(nIH)+40;
    	var margin_top = ((y-(iH-20))/2)+15;
    	
    	var profBodyHtml = "<table align='center' cellpadding='0' cellspacing='0' class='gal_table' style='margin-top:"+margin_top+"px;'>"+
		"<tr>"+
		"	<td class='s_fig_1'>&nbsp;</td>"+
		"	<td class='s_fig_8'>&nbsp;</td>"+
		"	<td class='s_fig_7'>&nbsp;</td>"+
		"</tr>"+
		"<tr>"+
		"	<td class='s_fig_2'>&nbsp;</td>"+
		"	<td align='justify' class='s_fig_9'><iframe style=\"visibility:visible;\" id=\"vid_box\" marginheight=\"0\" marginwidth=\"0\" frameborder=\"0\" height=\""+iH+"px\" width=\""+nIW+"px\" scrolling=\"no\" src=\"users/profileView.php?i="+this.user+"\">"+
		"		Your browser does not support inline frames or is currently configured not to display inline frames."+
		"	</iframe></td>"+
		"	<td class='s_fig_6'>&nbsp;</td>"+
		"</tr>"+
		"<tr>"+
		"	<td class='s_fig_3'>&nbsp;</td>"+
		"	<td class='s_fig_4'>&nbsp;</td>"+
		"	<td class='s_fig_5'>&nbsp;</td>"+
		"</tr>"+
	"</table>";
    	$('#picBody').html(profBodyHtml);
    },
    
    getScreenPropertie : function (need){
		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;
		}
		if(need == 'height'){
		  	return  myHeight;
		} else if (need == 'width'){
		  	return myWidth;
		}
	},

    createDiv : function(){
        var margin_top = (this.getScreenPropertie('height') - 19)/2;
    $("body").append("<div id='picBody' onclick='SoditajiPub.userProfBox.closeBox();'><img src='images/loader_5.gif' style='margin-top:"+margin_top+"px;'/></div>");
    	this.startBoxing();
    },
    
    toggelUserBox : function(uid){
    	this.user = uid;
    	this.createDiv();
  	}
}
