var mod_url = "http://www.longislandguide.com/";
var xmlhttp = false ;
createXmlHttpRequest();
function createXmlHttpRequest()
{
	try 
	{
		xmlhttp = new ActiveXObject("Msxml2.XMLHTTP");
	} catch(e){
		try {
				xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
			} catch(oc) {
				xmlhttp = null;
			}
	}
	if (!xmlhttp && typeof XMLHttpRequest != "undefined") {
		xmlhttp = new XMLHttpRequest();
	}
}
/*********************************************
*********************Data Retrival Functions
*********************************************/
//*****************************************************
function get_blogs(div_id,m_profile_id)
{
//alert(m_profile_id);
//alert(div_id);
	xmlhttp.open('POST', mod_url + "blog/new_blogs.php",false);
	xmlhttp.setRequestHeader('Content-Type','application/x-www-form-urlencoded');
	xmlhttp.send();
	document.getElementById("" + div_id + "").innerHTML = xmlhttp.responseText;
}
//*********************top_blogers***********************	
function top_blogers(div_id,m_profile_id)
{
	xmlhttp.open('POST', mod_url + "blog/top_blogers.php",false);
	xmlhttp.setRequestHeader('Content-Type','application/x-www-form-urlencoded');
	xmlhttp.send();
	document.getElementById("" + div_id + "").innerHTML = xmlhttp.responseText;
}

//*********************Blogs Category***********************	
function blogs_category(div_id,m_profile_id)
{

	xmlhttp.open('POST', mod_url + "blog/blog_category.php",false);
	xmlhttp.setRequestHeader('Content-Type','application/x-www-form-urlencoded');
	xmlhttp.send();
	document.getElementById("" + div_id + "").innerHTML = xmlhttp.responseText;
}
//------------------------------------------------------------------------------------------
//******************************************************/

function get_data(div_id , m_m_url, m_m_param )
{
	xmlhttp.open('POST', mod_url + m_m_url ,false);
	xmlhttp.setRequestHeader('Content-Type','application/x-www-form-urlencoded');
	xmlhttp.send(m_m_param);
	document.getElementById("" + div_id + "").innerHTML = xmlhttp.responseText;
}	

function get_search(div_id,m_profile_id)
{
	xmlhttp.open('POST', mod_url + "include/home_search.php",false);
	xmlhttp.setRequestHeader('Content-Type','application/x-www-form-urlencoded');
	xmlhttp.send();
	document.getElementById("" + div_id + "").innerHTML = xmlhttp.responseText;
	//document.write(xmlhttp.responseText);
}	
function get_channels(div_id)
{
	xmlhttp.open('POST', mod_url + "channels/channels_nav.php",false);
	xmlhttp.setRequestHeader('Content-Type','application/x-www-form-urlencoded');
	xmlhttp.send();
	document.getElementById("" + div_id + "").innerHTML = xmlhttp.responseText;
	//document.write(xmlhttp.responseText);
}	
function get_view_profile(div_id , m_profile_id)
{
	document.getElementById("" + div_id + "").innerHTML = "Loading.....";
	xmlhttp.open('POST', mod_url + "members/view_profile.php",false);
	xmlhttp.setRequestHeader('Content-Type','application/x-www-form-urlencoded');
   	xmlhttp.send("profile_id=" + m_profile_id );
	document.getElementById("" + div_id + "").innerHTML = xmlhttp.responseText;
}	

function get_view_myblogs(div_id , m_profile_id)
{
	document.getElementById("" + div_id + "").innerHTML = "Loading.....";
	xmlhttp.open('POST', mod_url + "members/view_myblogs.php",false);
	xmlhttp.setRequestHeader('Content-Type','application/x-www-form-urlencoded');
   	xmlhttp.send("profile_id=" + m_profile_id );
	document.getElementById("" + div_id + "").innerHTML = xmlhttp.responseText;
}	

function get_view_mystuff(div_id , m_profile_id)
{
	document.getElementById("" + div_id + "").innerHTML = "Loading.....";
	xmlhttp.open('POST', mod_url + "members/view_mystuff.php",false);
	xmlhttp.setRequestHeader('Content-Type','application/x-www-form-urlencoded');
   	xmlhttp.send("profile_id=" + m_profile_id );
	document.getElementById("" + div_id + "").innerHTML = xmlhttp.responseText;
}	

function get_view_myfriends(div_id , m_profile_id)
{
	document.getElementById("" + div_id + "").innerHTML = "Loading.....";
	xmlhttp.open('POST', mod_url + "members/view_myfriends.php",false);
	xmlhttp.setRequestHeader('Content-Type','application/x-www-form-urlencoded');
   	xmlhttp.send("profile_id=" + m_profile_id );
	document.getElementById("" + div_id + "").innerHTML = xmlhttp.responseText;
}	

function get_view_settings(div_id , m_profile_id)
{
	document.getElementById("" + div_id + "").innerHTML = "Loading.....";
	xmlhttp.open('POST', mod_url + "members/view_settings.php",false);
	xmlhttp.setRequestHeader('Content-Type','application/x-www-form-urlencoded');
   	xmlhttp.send("profile_id=" + m_profile_id );
	document.getElementById("" + div_id + "").innerHTML = xmlhttp.responseText;
}	
function get_view_advertisers(div_id , m_profile_id)
{
	document.getElementById("" + div_id + "").innerHTML = "Loading.....";
	xmlhttp.open('POST', mod_url + "advertisers/profile_advertiser.php",false);
	xmlhttp.setRequestHeader('Content-Type','application/x-www-form-urlencoded');
   	xmlhttp.send("profile_id=" + m_profile_id );
	document.getElementById("" + div_id + "").innerHTML = xmlhttp.responseText;
}	
function get_view_coupon(div_id , m_profile_id)
{
	document.getElementById("" + div_id + "").innerHTML = "Loading.....";
	xmlhttp.open('POST', mod_url + "advertisers/add_coupon.php",false);
	xmlhttp.setRequestHeader('Content-Type','application/x-www-form-urlencoded');
   	xmlhttp.send("profile_id=" + m_profile_id );
	document.getElementById("" + div_id + "").innerHTML = xmlhttp.responseText;
}

/*********************************************
*********************Controler
*********************************************/
var w = window;
var d = document;

var m_url ='';
var m_param='';
var div_id ='';
var m_user_id='';
var m_profile_id='';
div_id = w.mod_div_id;
m_profile_id = w.profile_id;
m_url = w.page_url;
m_param = w.page_param;

/************* For Channels***********/
if (w.mod_action == 1)
{
	get_channels(div_id);
}
/************* For View Profile***********/
if (w.mod_action == 2)
{	
	get_view_profile(div_id,m_profile_id);
}
/************* For View myBlogs***********/
if (w.mod_action == 3)
{	
	get_view_myblogs(div_id,m_profile_id);
}
/************* For View mystuff***********/
if (w.mod_action == 4)
{	
	get_view_mystuff(div_id,m_profile_id);
}
/************* For View myfriends***********/
if (w.mod_action == 5)
{	
	get_view_myfriends(div_id,m_profile_id);
}
/************* For View settings***********/
if (w.mod_action == 6)
{	
	get_view_settings(div_id,m_profile_id);
}
/************* For View settings***********/
if (w.mod_action == 7)
{	
	get_view_advertisers(div_id,m_profile_id);
}
/************* For View settings***********/

if (w.mod_action == 8)
{	
	get_view_coupon(div_id,m_profile_id);
}
/************* For View search***********/
if (w.mod_action == 9)
{	
	get_search(div_id,m_profile_id);
}
if (w.mod_action == 9)
{	
	get_search(div_id,m_profile_id);
}
if (w.mod_action == 0)
{	
	//alert(div_id);
	get_data(div_id, m_url, m_param);
}
//*************Blogs************************
//*************get blogs********************
if (w.mod_action == 10)
{	
	get_blogs(div_id,m_profile_id);
}
//********top_belogers**********************
if (w.mod_action == 11)
{

	top_blogers(div_id,m_profile_id);
}
//********belog categories**********************
if (w.mod_action == 12)
{
	blogs_category(div_id,m_profile_id);
}
//******************************************
