/*
// JavaScript Document - VideoGals by www.AXXIS.gr
* @name videogals 1.3.5
* Created By Chris grVulture Michaelides
* http://www.axxis.gr
* @copyright  Copyright (C) 2009,2010  AXXIS INTERNET SOLUTIONS / All rights reserved.
* @license http://www.gnu.org/copyleft/gpl.html GNU/GPL, see LICENSE.php
*/

var xmlhttp;
if (!xmlhttp) {
try {
  xmlhttp = new XMLHttpRequest();
}
catch (e) {
  xmlhttp=false;
  alert(e);
}
}

if  (document.getElementById){(
  function(){
  
    //Stop Opera selecting anything whilst dragging.
    if (window.opera){
      document.write("<input type='hidden' id='Q' value=' '>");
    }
    var n = 500;
    var dragok = false;
    var y,x,d,dy,dx;
    
    function move(e){
      if (!e) e = window.event;
      if (dragok){
        d.style.left = dx + e.clientX - x + "px";
        d.style.top  = dy + e.clientY - y + "px";
        return false;
      }
    }
    
    function down(e){
      if (!e) e = window.event;
      var temp = (typeof e.target != "undefined")?e.target:e.srcElement;
      if (temp.tagName != "HTML"|"BODY" && temp.className != "dragclass"){
        temp = (typeof temp.parentNode != "undefined")?temp.parentNode:temp.parentElement;
      }
      if (temp.className == "dragclass"){
        if (window.opera){
          document.getElementById("Q").focus();
        }
        dragok = true;
        temp.style.zIndex = n++;
        d = temp;
        dx = parseInt(temp.style.left+0);
        dy = parseInt(temp.style.top+0);
        x = e.clientX;
        y = e.clientY;
        document.onmousemove = move;
        return false;
      }
    }
    
    function up(){
      dragok = false;
      document.onmousemove = null;
    }
    
    document.onmousedown = down;
    document.onmouseup = up;
    
  }
)();}//End.

function publish(id,f,table) {
    var xmlMessage = 'id='+id+'&publish='+f+'&table='+table;
    var grsite = document.getElementById('grsite').value;
    if (f==1) {
      document.getElementById('publish'+table+id).innerHTML = '<a href="javascript:publish('+id+',0,\''+table+'\')"><img src="'+grsite+'tick.png" /></a>';
    } else {
      document.getElementById('publish'+table+id).innerHTML = '<a href="javascript:publish('+id+',1,\''+table+'\')"><img src="'+grsite+'publish_x.png" /></a>';
    }
    var grsite = document.getElementById('grroot').value;
    xmlhttp.open("POST", grsite+'components/com_simplerating/tables/publish.php', false);
    // for ie compatability
    xmlhttp.setRequestHeader('Content-Type','application/x-www-form-urlencoded');
    xmlhttp.send(xmlMessage);
}