
								var addthis_pub = 'w-m.net';
								var  addthis_url   = '';
								var  addthis_title = '';
								function addthis_click(obj, str) {
								 var aturl  = 'http://www.addthis.com/bookmark.php';
								 aturl += '?v=1';
								 aturl += '&pub='+addthis_pub;
								 aturl += '&url='+encodeURIComponent(addthis_url);
								 aturl += '&title='+encodeURIComponent(addthis_title);
								 window.open(aturl,'addthis','scrollbars=yes,menubar=no,width=620,height=520,resizable=yes,toolbar=no,location=no,status=no,screenX=200,screenY=100,left=200,top=100');
								 return false;
								}
function say_thanks ()
{
	alert ("Thanks for you comment!");
}
function addFavorite(x){
if (document.all && !window.opera) {
if (typeof window.external == "object") {
window.external.AddFavorite(document.location, document.title);
return true;
}
else return false;
}
else{
x.href=document.location;
x.title=document.title;
x.rel = "sidebar";
return true;
}
}
function select_txt(id) {
    var rng;
    rng = document.getElementById(id);
    rng.focus();
    rng.select();
}
function show_info()
{
    $("g_info").style.display = "block";
}

function $ (id)
{
	return document.getElementById (id);
}

function show_tab (tab_name)
{
	$('tab_movie').style.display = "none";
	$('tab_share').style.display = "none";
    $('tab_reviews').style.display = "none";
    
    if($('tab_trailer'))
	$('tab_trailer').style.display = "none";
    $('tab_playlists').style.display = "none";

    $('div_tab_movie').className = "zakladkaSmoll";
	$('div_tab_share').className = "zakladkaSmoll";
    if($('div_tab_trailer'))
    $('div_tab_trailer').className = "zakladkaSmoll";
	$('div_tab_playlists').className = "zakladkaSmoll";
    $('div_tab_reviews').className = "zakladkaSmoll";

    $('font_tab_movie').className = "norm";
	$('font_tab_share').className = "norm";
    $('font_tab_reviews').className = "norm";

    if($('font_tab_trailer'))
    $('font_tab_trailer').className = "norm";
	$('font_tab_playlists').className = "norm";

	$(tab_name).style.display = "block";
    $("font_"+tab_name).className = "selekt";
    $("div_"+tab_name).className = "zakladkar";
}
function show_version_tab (tab_name)
{
    if($('div_version_content_video')!=null)
    {
        $('div_version_content_video').style.display = "none";
        $('div_version_tab_video').className = "zakladkaSmoll";
        $('font_tab_video').className = "norm";
    }
 /*   if($('div_version_content_2')!=null)

    {
        $('div_version_content_2').style.display = "none";
        $('div_version_tab_2').className = "zakladkaSmoll";
        $('font_tab_2').className = "norm";
    }*/
    if($('div_version_content_links')!=null)
    {
        $('div_version_content_links').style.display = "none";
        $('div_version_tab_links').className = "zakladkaSmoll";
        $('font_tab_links').className = "norm";
    }
    if($('div_version_content_trailers')!=null)
    {
        $('div_version_content_trailers').style.display = "none";
        if($('div_version_tab_trailers')!=null)
        $('div_version_tab_trailers').className = "zakladkaSmoll";
        if($('font_tab_trailers')!=null)
        $('font_tab_trailers').className = "norm";
    }
	$("div_version_content_"+tab_name).style.display = "block";
    $("font_tab_"+tab_name).className = "selekt";
    $("div_version_tab_"+tab_name).className = "zakladkar";
}
function show_user_tab (tab_name)
{
	$('avatar_tab_div').style.display = "none";
	$('profile_tab_div').style.display = "none";
    $('div_profile_tab_div').className = "zakladka";
    $('div_avatar_tab_div').className = "zakladka";
    $('font_profile_tab_div').className = "norm";
	$('font_avatar_tab_div').className = "norm";

    $("font_"+tab_name).className = "selekt";
    $("div_"+tab_name).className = "zakladkar"
    $(tab_name).style.display = "block";
}

var prevCommentId = null;
function show_quick_reply_form (commentId)
{
	if (prevCommentId != null)
		$("quick_reply_area_" + prevCommentId).style.display = "none";
	$("quick_reply_area_" + commentId).style.display = "block";
	prevCommentId = commentId;
}

function show_spoiler (spoiler_id)
{
	if ($('spoiler_' + spoiler_id).style.display == "none")
		$('spoiler_' + spoiler_id).style.display = "block";
	else
		$('spoiler_' + spoiler_id).style.display = "none";
		
}

function message_mode (tab_id)
{
	$("inbox_div").style.display = "none";
	$("outbox_div").style.display = "none";
	$('div_outbox_div').className = "zakladka";
    $('div_inbox_div').className = "zakladka";
    $('font_outbox_div').className = "norm";
	$('font_inbox_div').className = "norm";

    $("font_"+tab_id).className = "selekt";
    $("div_"+tab_id).className = "zakladkar"
	$(tab_id).style.display = "block";
}

function highlight_star (index)
{
/*	if (hasVoted)
		return;
	for (var i = 0 ; i <= 4 ; i++)
	{
		if (i <= index)
			$("star_" + i).src = cybimg + "selectrate.png";
		else
			$("star_" + i).src = cybimg + "emtyrate.png";
	}
    */
   	if (hasVoted)
		return;
	for (var i = 0 ; i < 10 ; i++)
	{
		if (i <= index)
            {
                if(i % 2 == 0)
                    $("star_" + i).src = cybimg + "jastratel.png";
                else{
                    $("star_" + i).src = cybimg + "jastrater.png";
                }
            }
		else
            {
             if(i % 2 == 0)
                $("star_" + i).src = cybimg + "emtyratel.png";
             else{
                 $("star_" + i).src = cybimg + "emtyrater.png";
                 }
            }
	}
}

var hasVoted = false;
var voteRating = -1;

function reset_rating (rating)
{	
/*	if (hasVoted)
		return;
	for (var i = 0 ; i <= 4 ; i++)
	{
		if (i < Math.floor(rating/2))
			$("star_" + i).src = cybimg + "selectrate.png";
		else
			$("star_" + i).src = cybimg + "emtyrate.png";
	}*/
    if (hasVoted)
		return;
	for (var i = 0 ; i < 10 ; i++)
	{
		if (i < Math.floor(rating))
            {
                if(i % 2 == 0)
                    $("star_" + i).src = cybimg + "selectratel.png";
                else
                    $("star_" + i).src = cybimg + "selectrater.png";
            }
		else{
            if(i % 2 == 0)
                $("star_" + i).src = cybimg + "emtyratel.png";
            else
               $("star_" + i).src = cybimg + "emtyrater.png";
        }
	}
}

function set_user_rating (rating)
{
/*	hasVoted = true;
	for (var i = 0 ; i <= 4 ; i++)
	{
		if (i <= Math.floor(rating/2))
			$("star_" + i).src = cybimg + "jastrate.png";
		else
			$("star_" + i).src = cybimg + "emtyrate.png";
	}*/
    hasVoted = true;
	for (var i = 0 ; i < 10 ; i++)
	{
		if (i <= Math.floor(rating/2))
            {
            if(i % 2 == 0)
                $("star_" + i).src = cybimg + "jastratel.png";
            else
               $("star_" + i).src = cybimg + "jastrater.png";
            }
		else{
            if(i % 2 == 0)
                $("star_" + i).src = cybimg + "emtyratel.png";
            else
               $("star_" + i).src = cybimg + "emtyrater.png";
        }
	}
}

function callback_broken_link (id)
{
	$('link_group_' + id).style.display = "none";
    $('link_group_thanks_' + id).className="divRamka";
	$('link_group_thanks_' + id).innerHTML = "Thanks.";
}
function check_focus(id,name)
{
    if(document.getElementById(id+"_error1").style.display=="block")
        return;
    if(name=="password2")
        return;
    if(name=="password")
        if(document.getElementById(id+"_error2").style.display=="block")
        return;
    if(name=="login")
        if(document.getElementById(id+"_error2").style.display=="block")
        return;

    document.getElementById(id+"_info").style.display="block";
}
function check_blur(id,name,number)
{
    if(name=="password2")
        {
            if(document.getElementById(id+"_2").value!=document.getElementById(id).value)
                document.getElementById(id+"_2_error").style.display="block";
            else
                document.getElementById(id+"_2_error").style.display="none";

            return;
        }
   document.getElementById(id+"_error1").style.display="none";
   document.getElementById(id+"_info").style.display="none";
    if(name=="password")
     {
         document.getElementById(id+"_error2").style.display="none";
        if(validator( true, true , document.getElementById(id).value)==false)
            document.getElementById(id+"_error1").style.display="block";
        if(checkNumber(document.getElementById(id).value,number)==false)
            document.getElementById(id+"_error2").style.display="block";
     }
     if(name=="login")
     {
         document.getElementById(id+"_error2").style.display="none";
        if(validator( true, true , document.getElementById(id).value)==false)
            document.getElementById(id+"_error1").style.display="block";
        if(checkNumber(document.getElementById(id).value,number)==false)
            document.getElementById(id+"_error2").style.display="block";
     }
    if(name=="email")
     {
        if(checkEmail(document.getElementById(id).value)==false)
            document.getElementById(id+"_error1").style.display="block";
     }
}
function checkEmail(text)
{
    var filter = /^([a-zA-Z0-9_\.\-])+\@(([a-zA-Z0-9\-])+\.)+([a-zA-Z0-9]{2,4})+$/;
    if (!filter.test(text)) {
        return false;
    }
    return true;
}
function checkNumber(string,number)
{
    if(string.length<number)
        return false;

    return true;
}
function notEmtyr(id)
{
    if(document.getElementById(id+"_error1").style.display=="block")
        {
         string=document.getElementById(id).value.replace(/ /g,"");
            if(string.length<1)
                {
                document.getElementById(id+"_error1").style.display="block";
                return;
                }
            else
           document.getElementById(id+"_error1").style.display="none";
        }
    document.getElementById(id+"_info").style.display="block";
}
function notEmty(id)
{
    document.getElementById(id+"_info").style.display="none";
    string=document.getElementById(id).value.replace(/ /g,"");
    if(string.length<1)
      document.getElementById(id+"_error1").style.display="block";
    else
       document.getElementById(id+"_error1").style.display="none";
}
function chackFormCont(id)
{
    notEmty(id);
    if(document.getElementById(id+"_error1").style.display!="block")
        {
           document.getElementById("form_"+id).submit();
           return true;
        }
    else
            return false;
}
function chackForm(id)
{
    var string=document.getElementById(id).value.replace(/ /g,"");
    if(string.length<1)
    {
        alert("Comment could not be empty!");
        return false;
    }
    else
        {
        //document.getElementById("form_"+id).submit();
        return true;
        }
    

   //return true;
}
function delete_coment(coment_id , table)
{
    if(confirm('Are you sure you want to delete this comment?'))
    {

    if (table == null)
        xajax_delete_comment(coment_id);
    else
        xajax_delete_comment(coment_id , table);
    $("comment_"+coment_id).style.display="none";
    }
}
function readMore(id)
{
    $("pointer_"+id).style.display="none";
    $("bottom_"+id).style.display="inline";
    $("more_"+id).style.display="none";
    $("less_"+id).style.display="inline";
}
function readLess(id)
{
    $("pointer_"+id).style.display="inline";
    $("bottom_"+id).style.display="none";
    $("more_"+id).style.display="inline";
    $("less_"+id).style.display="none";
}

function indexOf (source , find)
{
     for(var i=0; i<source.length; i++){
	            if(source[i]==find){
	                return i;
	            }
	        }
            return -1;
}

function validator (isNumber , isLetter , text)
{
    var numbers = "0123456789";
    var letters = "QWERTYUIOPASDFGHJKLZXCVBNMqwertyuiopasdfghjklzxcvbnm_";
   /* var specChars = "!@&#@&^$*(#($#()$(#";*/

    var alphabet = "";
    if (isNumber)
        alphabet += numbers;
    if (isLetter)
        alphabet += letters;

		for (i = 0 ; i < text.length; i++)
		{
				nomer = indexOf(alphabet, text[i]);
				if(nomer ==-1)
				{
					return false;
				}
        }
        return true;
}

function mark_spoiler(el) {var w = "spoiler";var e=document.getElementById(el);var s=document.selection;e.focus();if(s){var r=s.createRange();var d=r.duplicate();var	t=" ["+w+"] "+d.text+" [/"+w+"] ";}else{var ss=e.selectionStart;var se=e.selectionEnd;var t=e.value.substring(0,ss)+" ["+w+"] "+e.value.substring(ss,se)+" [/"+w+"] "+e.value.substring(se);}t=t.replace(/( )+\[\/(i|b|u|quote)\]/img,"[/$2]$1");if(d)d.text=t;else{e.value=t;e.selectionEnd=e.selectionStart=ss;}return false}

function scroll_year (dx)
{
    //alert ("min:" + minBrowseYear.toString());
    //alert ("max:" + maxBrowseYear.toString());
    //alert ("browse:" + (browseYear + dx).toString());
    if (browseYear + dx > maxBrowseYear)
        browseYear = maxBrowseYear;
    else
    if (browseYear + dx < minBrowseYear + 4)
        browseYear = minBrowseYear + 4;
    else
        browseYear = browseYear + dx;
        
        for (var i = 0; i < 5 ; i++)
        {
            if (browseYear - i != selectedBrowseYear)
                $("year_place_" + i).innerHTML = (browseYear - i).toString();
            else
                $("year_place_" + i).innerHTML = "<b>" + (browseYear - i).toString() + "</b>";

            $("year_place_" + i).href = cyburl + "/browse_movies/" + selectedGenre + "/" + selectedFilter + "/" + (browseYear - i).toString() + "/" ;
        }
}

/*function show_suggestion (struct)
{
    //var films = JSON.parse(struct, null);
    //$("test_me").innerHTML = films.length;
}*/


function microtime(get_as_float)
{
        // Returns either a string or a float containing the current time in seconds and microseconds
       var now = new Date().getTime() / 1000;
       var s = parseInt(now);
  
       return (get_as_float) ? now : (Math.round((now - s) * 1000) / 1000) + ' ' + s;
}

var showSuggestion = false;
var lastKeyStroke = 0;
function search_suggest (text)
{
    var r=document.getElementById("search_select");
    if(r.options[r.selectedIndex].value == "title" || r.options[r.selectedIndex].value == "actor")
    {
        lastKeyStroke = microtime(true);
        setTimeout (function () {if (microtime(true) - lastKeyStroke > 1) xajax_search_suggest(text , r.options[r.selectedIndex].value);} , 1100);
    }
}

var last_link_group = null;
function highlight_link_group (id)
{
    if (last_link_group != null)
        $(last_link_group).style.border = "0px";
    $(id).style.border = "1px red double";
    last_link_group = id;
}


function message_do (value)
{
    $("message_action").value = value;
    $("message_form").submit ();
}

function message_select_all()
{
    for (var i = 1 ;i <= 10 ; i++)
    {
        if ($("message_id" + i)  != null)
        {
            $("message_id" + i).checked = "checked";
        }
    }
}
function chatbox_message_send ()
{
    $("chatbox_message_send_div").style.display = "block";
    setTimeout(function() {$("chatbox_message_send_div").style.display = "none";}, 2000);
}
function message_select_none()
{
    for (var i = 1 ;i <= 10 ; i++)
    {
        if ($("message_id" + i)  != null)
        {
            $("message_id" + i).checked = "";
        }
    }
}