/*
$Id: fixes.js,v 1.1 2008/11/18 11:23:32 max Exp $
vim: set ts=2 sw=2 sts=2 et:
*/

/*
  Position:absolute elements will not move when window is resized if a sibling contains float elements and a clear:both element
  https://bugzilla.mozilla.org/show_bug.cgi?id=442542
  FireFox 3.0+
*/
if (navigator.userAgent.toLowerCase().search(/firefox\/(3\.\d+)/i) != -1 && typeof(window.$) != 'undefined') {
  $.event.add(
    window,
    'resize',
    function() {
      var h = document.getElementById('header');
      if (!h || $(h).css('position') != 'absolute')
        return;

      document.getElementById('header').style.position = 'static';
      setTimeout(
        function() {
          document.getElementById('header').style.position = 'absolute';
        },
      20);
    }
  );
}
var val = "";
function unsubscrVal(subscr,selId){
//alert(subscr);
	val = document.getElementById('unsubscribe').value;
	if(val == '')
		val = selId + "," +subscr;
	else
		val = val+";"+selId+","+subscr;
	document.getElementById('unsubscribe').value = val;
}
function popup(){
	var popup1;
	var txt = document.getElementById('unsubscribe');
	window.passed1 = txt.value;
	popup1 = window.open('updatePopup.html', 'UpdateSubscriptions', 'width=300, height=300,top=300, left=300');
}
function update(){
	val="";
	window.opener.document.subscription.submit();
	window.close();
}
function cancel(){
	window.opener.document.subscription.reset();
	window.opener.document.getElementById('unsubscribe').value = '';
	window.close();
}

//Ajax Main script
function getXmlHttpObject(){
	var objXMLHttp = null;
	//Mozilla/ Safari/ NN
	if(window.XMLHttpRequest){
		objXMLHttp = new XMLHttpRequest();
	}
	//IE
	if(window.ActiveXObject){
		objXMLHttp=new ActiveXObject("Microsoft.XMLHTTP");
	}
	return objXMLHttp;
}
//Script Ends
//Function for getting the ratings type wise
function ajaxCommonFunction(divid,URL){
	objXML = getXmlHttpObject();
	objXML.onreadystatechange=function(){
		if(objXML.readyState==4 || objXML.readyState=='complete'){
			var res_str = new String();
			res_str = objXML.responseText;
			document.getElementById('showwating').style.display = "none";
			document.getElementById('showwating').innerHTML = "";
			document.getElementById(divid).innerHTML = res_str;
		}
	}
	objXML.open("GET",URL,true);
	objXML.send(null);	
	document.getElementById(divid).innerHTML = "<div id='showwating' align='center' ><img src='http://www.planetcomicsdirect.com/images/ajax-loaderImg.gif' /></div>";

}
//Functions Ends
function pubTitles(pubId){
	var URL = "ajax_subscription.php?pubId="+pubId;
	ajaxCommonFunction('titles1',URL);
}
var result = '';
function selectVal(title,selId){
	result = document.getElementById('titleData').value;
	if(result == '')
		result = selId + " --- " + title;
	else
		result = result+";"+selId + " --- " +title;
	document.getElementById('titleData').value = result;
}
function addTitlePopup(pubName){
	var addPop;
	var txt1 = document.getElementById('titleData');
	window.passed1 = txt1.value;
	window.passed2 = pubName;
	addPop = window.open('addTitlePopup.html', 'AddTitles', 'width=300, height=300,top=300, left=300');
}
function AddTitle(){
	result = "";
	window.opener.document.addTitle.submit();
	window.close();
}
function canceled(){
	window.opener.document.addTitle.reset();
	window.opener.document.getElementById('titleData').value = '';
	window.close();
}
