// JavaScript Document

$(document).ready(function(){
// Clearfix
	$('<style type="text/css">.clearfix:after {visibility: hidden;display: block;font-size: 0;content: " ";clear: both;height: 0;}* html .clearfix { zoom: 1; }*:first-child+html .clearfix { zoom: 1; }</style>').appendTo("head");
// Just Launched
	$("div.just-launched ul li:nth-child(3n+1)").addClass("RowFirst");
	$("div.just-launched ul li:nth-child(3n+3)").addClass("RowLast");
// favorite Sites	
	$("ul.favorite-sites li:nth-child(4n+1)").addClass("RowFirst");
	$("ul.favorite-sites li:nth-child(4n+4)").addClass("RowLast");
	$("ul.fs-list li:nth-child(4n+4)").addClass("RowLast");
// paraPadding
	if($('div').hasClass('paraPadding')) {
		var paraCount = $("div.paraPadding p").size();
		if(paraCount>=2){
			$(".paraPadding p:last").css('padding-bottom','0px');
		}
	};
//dzine-SPC Hover
	$("span.dzine-SPC-img a").hover(function(){
		$(this).parent().next("span.dzine-SPC-link").addClass("hovered");	
		Cufon.replace('span.hovered a',{ hover: true});
	}, function(){
		$("span.dzine-SPC-link").removeClass("hovered");
		Cufon.replace('span.dzine-SPC-link a',{ hover: true});
	});
// Left Min-Height
	if($('div#page-left').hasClass('fL')) {
		var minHeight = $("div#page-right").height();
		$('div#page-left').css('min-height',minHeight);
	};
 // For Right Navigation   
    if($("ul.right-nav li").size()>1){
        $("ul.right-nav li").addClass("bordrightnav-Top");
    }
    
});
 
   

var xmlHTTP = xmlobject();
function xmlobject() { // returns false if exists
    if (window.ActiveXObject) { // if IE
        try {
            return new ActiveXObject("Msxml2.XMLHTTP");
        }
        catch (e) {
            try {
                return new ActiveXObject("Microsoft.XMLHTTP");
            }
            catch (e) {
                return;
            }
        }
    }
    else if (window.XMLHttpRequest) { // if Mozilla, Safari, etc.
        return new XMLHttpRequest();
    }
}


function newspagination(i,hid)
{
    var ldtime = new Date();
    var url = "/ajax/ajax-newslanding.aspx?hid=" + hid + "&pgnum=" + i;    
    xmlHTTP.open('GET', url, true);
    xmlHTTP.onreadystatechange = display_details;
    xmlHTTP.send();
}

function newspagination1(i,hid)
{
var hid = document.getElementById("hfhid").value;
var type="filter";
var e = document.getElementById("drpfilter");
  var name = e.options[e.selectedIndex].value;
 var ldtime = new Date();
    var url = "/ajax/ajax-newslanding.aspx?brand="+name+"&type=filter&hid=" + hid + "&pgnum=" + i;    
    xmlHTTP.open('GET', url, true);
    xmlHTTP.onreadystatechange = display_details;
    xmlHTTP.send();

 }


function display_details()
{
 if (xmlHTTP.readyState == 4)
 {
     var response = xmlHTTP.responseText.split("_PH_SPLIT");     
    document.getElementById('divpaging').value = '';
    document.getElementById('divpaging').innerHTML = response[1];
    document.getElementById('divbtmpaging').value = '';
    document.getElementById('divbtmpaging').innerHTML = response[1];
    document.getElementById('divnews').value = '';
    document.getElementById('divnews').innerHTML = response[0];
    Cufon.refresh();
    
}
}



 function filternews()
  {
var e = document.getElementById("drpfilter");
var name = e.options[e.selectedIndex].value;
if(name=="0")
{
alert("Please select any brand");
return false;
}
var hid = document.getElementById("hfhid").value;
var type="filter";
var ldtime = new Date();
var url = "/ajax/ajax-newslanding.aspx?brand="+name+"&type=filter&hid=" + hid+"&pgnum=1";    
xmlHTTP.open('GET', url, true);
xmlHTTP.onreadystatechange = display_details;
xmlHTTP.send();
}


