function changeTab() //Switch the Tab
{
  ///setTimeout ( "doSomething()", 5000 );
  try {
	  if(document.getElementById('tab_1').style.display=='block') //If its a first Article
		{
			
			document.getElementById('tab_1').style.display='none'; // hide show thw div of image
			document.getElementById('tab_2').style.display='block'; //
			
	    }
	  else //If its a first Article
		{
			
			document.getElementById('tab_1').style.display='block';// hide show thw div of image
			document.getElementById('tab_2').style.display='none';
			
		}
  }catch(e)
  {
  
  }
}


function changePageVideo(topicId,offset)
{
	var url = 'page_video_index.php?topic_id='+topicId+'&offset='+offset;
		req = false;
		var req = getObject();
	 	if(req)
	 	{
			req.onreadystatechange = call_page_video_position;
			req.open("GET", url, true);
			req.send(null);
		}
}
function call_page_video_position()
{
	if(req.readyState == 4){
   
	 	var objXML1 = req.responseText;
		
	 	if(req.status==200)
		{	
			document.getElementById("putVideo").innerHTML=objXML1;
			
		  	
        }
      	
  }else{
  		
  }
}
function switchArticleTab(ArticleTabId,total)  //Switch The Writer Tab
{
  
		
		for(i=0;i<total;i++)
		{
			
			if(i==ArticleTabId)
			{
				
				document.getElementById('artcleTab_'+i).style.display='block';
				document.getElementById('ArtcleTabTitle_'+i).style.display='none';
				document.getElementById('ArticleTitle_'+i).style.display='block';
				
			}
			else
			{
				
				document.getElementById('artcleTab_'+i).style.display='none';
				document.getElementById('ArtcleTabTitle_'+i).style.display='block';
				document.getElementById('ArticleTitle_'+i).style.display='none';
			}
			
			
			
		}
		document.getElementById('hid_count').value=ArticleTabId;
}  //End Function

function switchWriterTab(WriterTabId)  //Switch The Writer Tab
{
  
		
		for(i=0;i<3;i++)
		{
			
			if(i==WriterTabId)
			{
				
				document.getElementById('writerTab_'+i).style.display='block';
				document.getElementById('WriterTabTitle_'+i).style.display='none';
				document.getElementById('WriterTitle_'+i).style.display='block';
				
				
				
			}
			else
			{
				
				document.getElementById('writerTab_'+i).style.display='none';
				document.getElementById('WriterTabTitle_'+i).style.display='block';
				document.getElementById('WriterTitle_'+i).style.display='none';
			}
			
			
		}
}  //End Function
function stab(o)  //Swirtching the Topic tab
{
	m=1;
    while (document.getElementById("s"+m))
	 {
	 document.getElementById("s"+m).style.display='none';
	 m++;
	 }
	 document.getElementById(o).style.display='block';
}
function lightboxclose() 
	{
		document.getElementById('m').className='off';
		document.getElementById('d').style.display='none';
 	}
function ddown(d)
	{
		i=1;
		while (document.getElementById("d"+i))
		{
		document.getElementById("d"+i).style.display='none';
		i++;
		}
		document.getElementById(d).style.display='block';
    }	
function dhide(d)
	{
		document.getElementById(d).style.display='none';
	}	
function sdown(s)
	{
		document.getElementById(s).style.display='block';
	}
function shide(s)
	{
		document.getElementById(s).style.display='none';
	}
function activateLoginLightbox() {
	if (document.all && document.createAttribute && document.compatMode != 'BackCompat') {
     // IE6 (and above) in standards mode
    			 document.getElementsByTagName('html')[0].style.overflow = 'hidden'; // set to '' to show
		} else {
     			document.body.style.overflow = 'hidden'; // set to '' to show
		}
		moveLightBox("LightBoxLogin");
	document.getElementById('m').className='on';
	document.getElementById('LightBoxLogin').style.display='block';
	document.getElementById('loginlightboxForm').style.display='none';
 	}
function closeLoginLightbox() {
	if (document.all && document.createAttribute && document.compatMode != 'BackCompat') {
     // IE6 (and above) in standards mode
    			 document.getElementsByTagName('html')[0].style.overflow = ''; // set to '' to show
		} else {
     			document.body.style.overflow = ''; // set to '' to show
		}
    document.getElementById('m').className='off';
	document.getElementById('LightBoxLogin').style.display='none';
 	}
 	
 
function activateLoginLightForget() {
	if (document.all && document.createAttribute && document.compatMode != 'BackCompat') {
     // IE6 (and above) in standards mode
    			 document.getElementsByTagName('html')[0].style.overflow = 'hidden'; // set to '' to show
		} else {
     			document.body.style.overflow = 'hidden'; // set to '' to show
		}
		moveLightBox("forGetlightboxForm");
	document.getElementById('m').className='on';
	document.getElementById('forGetlightboxForm').style.display='block';
	document.getElementById('loginlightboxForm').style.display='none';
 	}
 	
 	function activateEmailLightBox() {
	if (document.all && document.createAttribute && document.compatMode != 'BackCompat') {
     // IE6 (and above) in standards mode
    			 document.getElementsByTagName('html')[0].style.overflow = 'hidden'; // set to '' to show
		} else {
     			document.body.style.overflow = 'hidden'; // set to '' to show
		}
		moveLightBox("emailLightboxForm");
	document.getElementById('m').className='on';
	document.getElementById('emailLightboxForm').style.display='block';
 	}
	
function forgetlightboxclose() {
		if (document.all && document.createAttribute && document.compatMode != 'BackCompat') {
     // IE6 (and above) in standards mode
    			 document.getElementsByTagName('html')[0].style.overflow = ''; // set to '' to show
		} else {
     			document.body.style.overflow = ''; // set to '' to show
		}
    document.getElementById('m').className='off';
	document.getElementById('forGetlightboxForm').style.display='none';
	
 	}
 		
function emailLightboxclose() {
		if (document.all && document.createAttribute && document.compatMode != 'BackCompat') {
     // IE6 (and above) in standards mode
    			 document.getElementsByTagName('html')[0].style.overflow = ''; // set to '' to show
		} else {
     			document.body.style.overflow = ''; // set to '' to show
		}
    document.getElementById('m').className='off';
	document.getElementById('emailLightboxForm').style.display='none';
	
 	}
 	
 	function loginlightboxclose() {
 	if (document.all && document.createAttribute && document.compatMode != 'BackCompat') {
     // IE6 (and above) in standards mode
    			 document.getElementsByTagName('html')[0].style.overflow = ''; // set to '' to show
		} else {
     			document.body.style.overflow = ''; // set to '' to show
		}
    document.getElementById('m').className='off';
    document.getElementById('user_email2').value='';
    document.getElementById('pass2').value='';
	document.getElementById('loginlightboxForm').style.display='none';
	
 	}



function call_abuse(userId,commentId,Id,SitePath,type)
{
	
	if(userId!=0)
	{
		
		var url = SitePath+'postAbuse.php?fld_comment_id='+commentId+'&fld_id='+Id+'&type='+type;	
		
		req = false;
	
		var req = getObject();
	
	 	if(req)
	 	{
			req.onreadystatechange = postAbuse;
			req.open("GET", url, true);
			req.send(null);
		}
	}
	else
	{
		insertTempAbuse(SitePath,'article_abuse',commentId,Id);
		//alert("You must login before sending abuse report.");
		open_login_lightBox('You must login before sending abuse report.');

	}	
}
function insertTempAbuse(SitePath,action,commentId,Id)
{
	if(action!='')
	{
		
		var url = SitePath+'temp_action.php?action='+action+'&commentId='+commentId+'&videoId='+Id;
		req = false;
			var req = getObject();
		 	if(req)
		 	{
				req.onreadystatechange = call_temp_abuse;
				req.open("GET", url, true);
				req.send(null);
			}
		
	}	
}
function call_temp_abuse()
{
	if(req.readyState == 4)
	{		
		
		if(req.status==200)
		{
					
	    }
	}
}	
function postAbuse()
{
	if(req.readyState == 4)
	{
		
		if(req.status==200)
		{
			alert('Abuse Report has been posted to admin.');
		}
		 else
        {
        	alert("There was a problem retrieving data :"+req.statusText);
        }
	}	
}	

function open_login_lightBox(msg)
{	moveLightBox("loginlightboxForm");
	document.getElementById('m').className='on';
	document.getElementById("loginlightboxForm").style.display='block';
	document.getElementById("lmsg").innerHTML=msg;
}
function open_broadcast_lightbox(msg)
{	document.getElementById("bmsg").innerHTML=msg;
	moveLightBox("broadcastLightboxDiv");
	document.getElementById('m').className='on';
	document.getElementById("broadcastLightboxDiv").style.display='block';

	
}
	function broadcastlightboxclose() {
	if (document.all && document.createAttribute && document.compatMode != 'BackCompat') {
     // IE6 (and above) in standards mode
    			 document.getElementsByTagName('html')[0].style.overflow = ''; // set to '' to show
		} else {
     			document.body.style.overflow = ''; // set to '' to show
		}
    document.getElementById('m').className='off';
	document.getElementById('broadcastLightboxDiv').style.display='none';
 	}
function moveLightBox(div)
{
	var BrowserDetect = {
	init: function () {
		this.browser = this.searchString(this.dataBrowser) || "An unknown browser";
		this.version = this.searchVersion(navigator.userAgent)
			|| this.searchVersion(navigator.appVersion)
			|| "an unknown version";
		this.OS = this.searchString(this.dataOS) || "an unknown OS";
	},
	searchString: function (data) {
		for (var i=0;i<data.length;i++)	{
			var dataString = data[i].string;
			var dataProp = data[i].prop;
			this.versionSearchString = data[i].versionSearch || data[i].identity;
			if (dataString) {
				if (dataString.indexOf(data[i].subString) != -1)
					return data[i].identity;
			}
			else if (dataProp)
				return data[i].identity;
		}
	},
	searchVersion: function (dataString) {
		var index = dataString.indexOf(this.versionSearchString);
		if (index == -1) return;
		return parseFloat(dataString.substring(index+this.versionSearchString.length+1));
	},
	dataBrowser: [
		{
			string: navigator.userAgent,
			subString: "Chrome",
			identity: "Chrome"
		},
		{ 	string: navigator.userAgent,
			subString: "OmniWeb",
			versionSearch: "OmniWeb/",
			identity: "OmniWeb"
		},
		{
			string: navigator.vendor,
			subString: "Apple",
			identity: "Safari",
			versionSearch: "Version"
		},
		{
			prop: window.opera,
			identity: "Opera"
		},
		{
			string: navigator.vendor,
			subString: "iCab",
			identity: "iCab"
		},
		{
			string: navigator.vendor,
			subString: "KDE",
			identity: "Konqueror"
		},
		{
			string: navigator.userAgent,
			subString: "Firefox",
			identity: "Firefox"
		},
		{
			string: navigator.vendor,
			subString: "Camino",
			identity: "Camino"
		},
		{		// for newer Netscapes (6+)
			string: navigator.userAgent,
			subString: "Netscape",
			identity: "Netscape"
		},
		{
			string: navigator.userAgent,
			subString: "MSIE",
			identity: "Explorer",
			versionSearch: "MSIE"
		},
		{
			string: navigator.userAgent,
			subString: "Gecko",
			identity: "Mozilla",
			versionSearch: "rv"
		},
		{ 		// for older Netscapes (4-)
			string: navigator.userAgent,
			subString: "Mozilla",
			identity: "Netscape",
			versionSearch: "Mozilla"
		}
	],
	dataOS : [
		{
			string: navigator.platform,
			subString: "Win",
			identity: "Windows"
		},
		{
			string: navigator.platform,
			subString: "Mac",
			identity: "Mac"
		},
		{
			   string: navigator.userAgent,
			   subString: "iPhone",
			   identity: "iPhone/iPod"
	    },
		{
			string: navigator.platform,
			subString: "Linux",
			identity: "Linux"
		}
	]

};
BrowserDetect.init();

	
		if(BrowserDetect.browser=='Explorer' && BrowserDetect.version>=7)
		{	
			//do nothing
		}
		else
		{	
		var scrolly = typeof window.pageYOffset != 'undefined' ? window.pageYOffset : document.documentElement.scrollTop;
				var scrollx = typeof window.pageXOffset != 'undefined' ? window.pageXOffset : document.documentElement.scrollLeft;
				document.getElementById(div).style.top = parseInt(scrolly)+"px";
				document.getElementById(div).style.left = parseInt(scrollx)+"px";
		
				if (document.all && document.createAttribute && document.compatMode != 'BackCompat') {
		     // IE6 (and above) in standards mode
		    			 document.getElementsByTagName('html')[0].style.overflow = 'hidden'; // set to '' to show
				} else {
		     			document.body.style.overflow = 'hidden'; // set to '' to show
		     	}
		} 	
     	
}		
function form_check(form)
{
	if(form.fld_subject.value=="")
	{
		alert('Please enter subject');
		form.fld_subject.focus();
		return false;
	}
	if(form.fld_comment.value=="")
	{
		alert('Please enter comment.');
		form.fld_comment.focus();
		return false;
	}		
}	
function open_popup(userId,path)
{
	if(userId!="0")
	{
		newwindow=window.open(path,'name','height=400,width=500,resizable=yes');
	}
	else
	{
		//alert("You must login before sending Email.");
		open_login_lightBox('You must login before sending Email.');
		
		
		
	}
}
function email_check(form)
{
	if(form.fld_subject.value == "")
	{
		alert("Please enter subject");
		form.fld_subject.focus();
		return false;
	}	
	if(form.fld_message.value == "")
	{
		alert("Please enter message");
		form.fld_message.focus();
		return false;
	}	
}
function send_check(form)
{
	if(form.fld_email.value == "")
	{
		alert("Please enter your friend email address");
		form.fld_email.focus();
		return false;
	}
	if(!emailCheck(form.fld_email.value))
	{
		form.fld_email.focus();
		return false;
	}	 	
	if(form.fld_name.value == "")
	{
		alert("Please enter your friend name");
		form.fld_name.focus();
		return false;
	}	
	
}
function emailCheck (emailStr) {
 
/* The following variable tells the rest of the function whether or not
to verify that the address ends in a two-letter country or well-known
TLD.  1 means check it, 0 means don't. */
 
var checkTLD=1;
 
/* The following is the list of known TLDs that an e-mail address must end with. */
 
var knownDomsPat=/^(com|net|org|edu|int|mil|gov|arpa|biz|aero|name|coop|info|pro|museum)$/;
 
/* The following pattern is used to check if the entered e-mail address
fits the user@domain format.  It also is used to separate the username
from the domain. */
 
var emailPat=/^(.+)@(.+)$/;
 
/* The following string represents the pattern for matching all special
characters.  We don't want to allow special characters in the address. 
These characters include ( ) < > @ , ; : \ " . [ ] */
 
var specialChars="\\(\\)><@,;:\\\\\\\"\\.\\[\\]\\'";
 
/* The following string represents the range of characters allowed in a 
username or domainname.  It really states which chars aren't allowed.*/
 
var validChars="\[^\\s" + specialChars + "\]";
 
/* The following pattern applies if the "user" is a quoted string (in
which case, there are no rules about which characters are allowed
and which aren't; anything goes).  E.g. "jiminy cricket"@disney.com
is a legal e-mail address. */
 
var quotedUser="(\"[^\"]*\")";
 
/* The following pattern applies for domains that are IP addresses,
rather than symbolic names.  E.g. joe@[123.124.233.4] is a legal
e-mail address. NOTE: The square brackets are required. */
 
var ipDomainPat=/^\[(\d{1,3})\.(\d{1,3})\.(\d{1,3})\.(\d{1,3})\]$/;
 
/* The following string represents an atom (basically a series of non-special characters.) */
 
var atom=validChars + '+';
 
/* The following string represents one word in the typical username.
For example, in john.doe@somewhere.com, john and doe are words.
Basically, a word is either an atom or quoted string. */
 
var word="(" + atom + "|" + quotedUser + ")";
 
// The following pattern describes the structure of the user
 
var userPat=new RegExp("^" + word + "(\\." + word + ")*$");
 
/* The following pattern describes the structure of a normal symbolic
domain, as opposed to ipDomainPat, shown above. */
 
var domainPat=new RegExp("^" + atom + "(\\." + atom +")*$");
 
/* Finally, let's start trying to figure out if the supplied address is valid. */
 
/* Begin with the coarse pattern to simply break up user@domain into
different pieces that are easy to analyze. */
 
var matchArray=emailStr.match(emailPat);
 
if (matchArray==null) {
 
/* Too many/few @'s or something; basically, this address doesn't
even fit the general mould of a valid e-mail address. */
 
alert("Email address seems incorrect (check @ and .'s)");
return false;
}
var user=matchArray[1];
var domain=matchArray[2];
 
// Start by checking that only basic ASCII characters are in the strings (0-127).
 
for (i=0; i<user.length; i++) {
if (user.charCodeAt(i)>127) {
alert("Ths username contains invalid characters.");
return false;
   }
}
for (i=0; i<domain.length; i++) {
if (domain.charCodeAt(i)>127) {
alert("Ths domain name contains invalid characters.");
return false;
   }
}
 
// See if "user" is valid 
 
if (user.match(userPat)==null) {
 
// user is not valid
 
alert("The username doesn't seem to be valid.");
return false;
}
 
/* if the e-mail address is at an IP address (as opposed to a symbolic
host name) make sure the IP address is valid. */
 
var IPArray=domain.match(ipDomainPat);
if (IPArray!=null) {
 
// this is an IP address
 
for (var i=1;i<=4;i++) {
if (IPArray[i]>255) {
alert("Destination IP address is invalid!");
return false;
   }
}
return true;
}
 
// Domain is symbolic name.  Check if it's valid.
 
var atomPat=new RegExp("^" + atom + "$");
var domArr=domain.split(".");
var len=domArr.length;
for (i=0;i<len;i++) {
if (domArr[i].search(atomPat)==-1) {
alert("The domain name does not seem to be valid.");
return false;
   }
}
 
/* domain name seems valid, but now make sure that it ends in a
known top-level domain (like com, edu, gov) or a two-letter word,
representing country (uk, nl), and that there's a hostname preceding 
the domain or country. */
 
if (checkTLD && domArr[domArr.length-1].length!=2 && 
domArr[domArr.length-1].search(knownDomsPat)==-1) {
alert("The address must end in a well-known domain or two letter " + "country.");
return false;
}
 
// Make sure there's a host name preceding the domain.
 
if (len<2) {
alert("This address is missing a hostname!");
return false;
}
 
// If we've gotten this far, everything's valid!
return true;
}
 // function to create object for XML/ActiveX com[
function getObject()
{
	if(window.XMLHttpRequest) 
	{	
		// branch for native XMLHttpRequest object
		try 
		{
			req = new XMLHttpRequest();
		} 
		catch(e) 
		{
			req = false;
		}
	}
	else if(window.ActiveXObject) 
	{	
		// branch for IE/Windows ActiveX version
		try 
		{
			req = new ActiveXObject("Msxml2.XMLHTTP");
		} 
		catch(e) 
		{
			try 
			{
				req = new ActiveXObject("Microsoft.XMLHTTP");
			} 
			catch(e) 
			{
				req = false;
			}
		}
	}
	return req;
}
function call_comment(SitePath,artId,page)
{
		var url = SitePath+'call_articles.php?artId='+artId+'&page='+page;	
		req = false;
		var req = getObject();
	 	if(req)
	 	{
			req.onreadystatechange = call_ajax;
			req.open("GET", url, true);
			req.send(null);
		}
}
function call_ajax()
{
	if(req.readyState == 4){
   
	 	var objXML1 = req.responseXML;
	 	if(req.status==200)
		{	
			var div=req.responseText.split("##");
		  	document.getElementById("div_comment_box").innerHTML=div[0];
		  	document.getElementById("div_paging").innerHTML=div[1];
		  	//document.getElementById("div_msg").innerHTML="";
		  	
        }
      	
  }else{
  		
  }
}	

function call_player_comment(SitePath,playerId,page)
{
		var url = SitePath+'call_player_comments.php?playerId='+playerId+'&page='+page;	
		req = false;
		var req = getObject();
	 	if(req)
	 	{
			req.onreadystatechange = player_comment_ajax;
			req.open("GET", url, true);
			req.send(null);
		}
}
	
function player_comment_ajax()
{
	if(req.readyState == 4){
   
	 	var objXML1 = req.responseXML;
	 	if(req.status==200)
		{	
			var div=req.responseText.split("##");
		  	document.getElementById("div_comment_box").innerHTML=div[0];
		  	document.getElementById("div_paging").innerHTML=div[1];
		  	//document.getElementById("div_msg").innerHTML="";
		  	
        }
      	
  }else{
  		
  }
}

function changeBasicStat(positionId)
{
	var url = 'change_basic_state.php?positionId='+positionId;	
	
		req = false;
		var req = getObject();
	 	if(req)
	 	{
			req.onreadystatechange = call_basic_stat;
			req.open("GET", url, true);
			req.send(null);
		}
}
function call_basic_stat()
{
	if(req.readyState == 4){
   
	 	var objXML1 = req.responseXML;
	 	if(req.status==200)
		{	
			document.getElementById("basicStatsDivId").innerHTML=req.responseText;
		  	
        }
      	
  }else{
  		
  }
}
function changeBasicPosition(typeId)
{
	var url = 'change_basic_position.php?typeId='+typeId;	
	
		req = false;
		var req = getObject();
	 	if(req)
	 	{
			req.onreadystatechange = call_basic_position;
			req.open("GET", url, true);
			req.send(null);
		}
}
function call_basic_position()
{
	if(req.readyState == 4){
   
	 	var objXML1 = req.responseXML;
	 	if(req.status==200)
		{	
			var div=req.responseText.split("##");
		  	document.getElementById("basicPositionDivId").innerHTML=div[1];
			changeBasicStat(div[0]);
			
		  	
        }
      	
  }else{
  		
  }
}

function changePageSearch(stateId,cls,fname,lname,position,offset,orderby,order)
{
	var url = 'page_preps_search.php?stateId='+stateId+'&class='+cls+'&fname='+fname+'&lname='+lname+'&position='+position+'&offset='+offset+'&orderby='+orderby+'&order='+order;
	req = false;
		var req = getObject();
	 	if(req)
	 	{
			req.onreadystatechange = call_page_preps_search;
			req.open("GET", url, true);
			req.send(null);
		}
}
function call_page_preps_search()
{
	if(req.readyState == 4){
   
	 	var objXML1 = req.responseText;
		
	 	if(req.status==200)
		{	
			document.getElementById("result_data").innerHTML=objXML1;
			
		  	
        }
      	
  }else{
  		
  }
}
function check_login_preps(SitePath,login,profile_id)
{
	if(login==0)
	{
		alert('You must be login to see the player card.');
		return false;
	}	
	else if(login==1)
	{
		window.location.href=SitePath+'my_player_card.php?profile_id='+profile_id;
		return false;
	}	
		
}

function call_division_list(divisionId)
{
	var url = 'call_team_list.php?divisionId='+divisionId;
	req = false;
		var req = getObject();
	 	if(req)
	 	{
			req.onreadystatechange = show_division_list;
			req.open("GET", url, true);
			req.send(null);
		}
}
function show_division_list()
{
	if(req.readyState == 4){
   
	 	var objXML1 = req.responseText;
		
	 	if(req.status==200)
		{	
			document.getElementById("teamlist").innerHTML=objXML1;
			
		  	
        }
      	
  }else{
  		
  }
}

function add_fan(SitePath,userId,playerId,existFan,status)
{
	if(userId!=0)
			{
				if(existFan==0)
				{
					if(confirm("Are you sure you want to be fan of this player?")) 
					{
						var url = SitePath+'addFan.php?profileId='+playerId;	
					
						req = false;
				
						var req = getObject();
				
				 		if(req)
				 		{
							req.onreadystatechange = addFan;
							req.open("GET", url, true);
							req.send(null);
						}
					}
					else
					{
						return false;
						
					}
				}
				else
				{
					if(status=='P')
					{
						alert("Be patience, your request is pending for approval");
					}
					else if(status=='A')
					{	
						alert("You are already exist in this player fan list!");
					}
				}	
			}
			
		else
		{
			insertTempJoinFan(SitePath,'join_fan',playerId);
			//alert("You must login to join the fan club of this player.");
			open_login_lightBox('You must login to join the fan club of this player.');
			
		}	

}
function insertTempJoinFan(SitePath,action,playerId)
{
	if(action!='')
	{
		
		var url = SitePath+'temp_action.php?action='+action+'&profileId='+playerId;
		req = false;
			var req = getObject();
		 	if(req)
		 	{
				req.onreadystatechange = call_temp_join;
				req.open("GET", url, true);
				req.send(null);
			}
		
	}	
}
function call_temp_join()
{
	if(req.readyState == 4)
	{		
		
		if(req.status==200)
		{
					
	    }
	}
}
function addFan()
{
	if(req.readyState == 4)
	{
		
		if(req.status==200)
		{
			var div=req.responseText;
			alert('Your fan request has been send succesfully');
			document.getElementById("div_fan").innerHTML=div;
		}
		else
        {
        	alert("There was a problem retrieving data :"+req.statusText);
        }
	}	
}

function call_overall_ajax(posId,cardId,profileId)
{
	var url = 'call_overall_ajax.php?profile_id='+profileId+'&posId='+posId+'&cardId='+cardId;	
					
						req = false;
				
						var req = getObject();
				
				 		if(req)
				 		{
							req.onreadystatechange = show_overall;
							req.open("GET", url, true);
							req.send(null);
						}
	
}

function show_overall()
{
	if(req.readyState == 4){
   
	 		var div=req.responseText.split("##");
		
	 	if(req.status==200)
		{	
			document.getElementById("div_comparable").innerHTML=div[0];
			document.getElementById("div_comp_rate").innerHTML=div[1];
			
		  	
        }
      	
  }else{
  		
  }
}


function call_stats_ajax(posId,cardId,profileId)
{
	var url = 'call_stats.php?profile_id='+profileId+'&posId='+posId+'&cardId='+cardId;	
						req = false;
				
						var req = getObject();
				
				 		if(req)
				 		{
							req.onreadystatechange = show_stats;
							req.open("GET", url, true);
							req.send(null);
						}
	
}

function show_stats()
{
	if(req.readyState == 4){
   
	 		var div=req.responseText.split("##");
		
	 	if(req.status==200)
		{	
			document.getElementById("div_comparable").innerHTML=div[0];
			document.getElementById("div_comp_rate").innerHTML=div[1];
			
		  	
        }
      	
  }else{
  		
  }
}

function call_results_ajax(posId,cardId,profileId)
{
	var url = 'call_results.php?profile_id='+profileId+'&posId='+posId+'&cardId='+cardId;	
					
						req = false;
				
						var req = getObject();
				
				 		if(req)
				 		{
							req.onreadystatechange = show_results;
							req.open("GET", url, true);
							req.send(null);
						}
	
}

function show_results()
{
	if(req.readyState == 4){
   
	 		var div=req.responseText.split("##");
		
	 	if(req.status==200)
		{	
			document.getElementById("div_comparable").innerHTML=div[0];
			document.getElementById("div_comp_rate").innerHTML=div[1];
			
		  	
        }
      	
  }else{
  		
  }
}

function call_video_stats(posId,cardId,profileId)
{
	var url = 'call_video.php?profile_id='+profileId+'&posId='+posId+'&cardId='+cardId;	
					
						req = false;
				
						var req = getObject();
				
				 		if(req)
				 		{
							req.onreadystatechange = show_videos_rate;
							req.open("GET", url, true);
							req.send(null);
						}
	
}

function show_videos_rate()
{
	if(req.readyState == 4){
   
	 		var div=req.responseText.split("##");
		
	 	if(req.status==200)
		{	
			document.getElementById("div_comparable").innerHTML=div[0];
			document.getElementById("div_comp_rate").innerHTML=div[1];
			
		  	
        }
      	
  }else{
  		
  }
}
function show_comment_div(login,divId)
{
	if(login!=0)
	{
		
			if(document.getElementById(divId).style.display=='none')
			{
				document.getElementById(divId).style.display='block';
			}
			else
			{
				document.getElementById(divId).style.display='none';
			}
		
	}	
	else
	{
		//alert("You must login before posting comment.");
		open_login_lightBox('You must login before posting comment.');
		
		
	}	
}
function call_article_next(SitePath,page,artId)
{
	var url = SitePath+'call_article_ajax.php?page='+page+'&artId='+artId;	
						req = false;
				
						var req = getObject();
				
				 		if(req)
				 		{
							req.onreadystatechange = show_article_content;
							req.open("GET", url, true);
							req.send(null);
						}
	
}

function show_article_content()
{
	if(req.readyState == 4){
   
	 		var div=req.responseText.split("###");
		
	 	if(req.status==200)
		{	//alert(req.responseText);
			document.getElementById("article_content").innerHTML=div[0];
			document.getElementById("article_paging").innerHTML=div[1];
			//document.getElementById("div_comp_rate").innerHTML=div[1];
			
		  	
        }
      	
  }else{
  		
  }
}

///////// function to show recent video or comment box
function call_box(div1,div2)
{
	document.getElementById(div1).style.display="block";
	document.getElementById(div2).style.display="none";
	document.getElementById(div1+'_t').className='midTab';
	document.getElementById(div2+'_t').className='midTabGrey';
}
function open_email_div(userId)
{
	
	if(userId!=0)
	{
		if(document.getElementById('div_email').style.display=='none')
		{
			document.getElementById('div_email').style.display='block';
		}
		else
		{
			document.getElementById('div_email').style.display='none';
		}
	}
	else
	{
		
		//alert("You must login before sending email.");
		open_login_lightBox('You must login before sending email.');
		
		
	}	
}
function open_comment_div(userId)
{
	if(userId!=0)
	{
		if(document.getElementById('div_comment').style.display=='none')
		{
			document.getElementById('div_comment').style.display='block';
					}
		else
		{
			document.getElementById('div_comment').style.display='none';
		}
	}
	else
	{
		open_login_lightBox('You must be login before posting comment');
	
		
		
	}
		
}
function open_upload_video_page(SitePath,userId)
{
	if(userId!=0)
	{
		window.location.href=SitePath+'./upload_video.php';
	}
	else
	{
		
		insertDataInTemp(SitePath,'upload_video');
		open_login_lightBox('You must be login for uploading video');
	
		
		
	}
		
}




function insertDataInTemp(SitePath,action)
{
	if(action!='')
	{
		
		var url = SitePath+'temp_action.php?action='+action;
		req = false;
			var req = getObject();
		 	if(req)
		 	{
				req.onreadystatechange = call_temp_section;
				req.open("GET", url, true);
				req.send(null);
			}
		
	}	
}
function call_temp_section()
{
	if(req.readyState == 4)
	{		
		
		if(req.status==200)
		{
					
	    }
	}
}


function open_send_div(userId)
{
	if(userId!=0)
	{
		if(document.getElementById('div_send').style.display=='none')
		{
			document.getElementById('div_send').style.display='block';
	
		}
		else
		{
			document.getElementById('div_send').style.display='none';
		
		}
	}
	else
	{
		
		open_login_lightBox('You must login before sending link.');
		
		
	}	
}

//////////////// function to add email address for newsletters
function AjaxSubmitEmail(sitePath)

{



		   	var email=document.getElementById('email').value;
			
			if(email!='')
			{
			
					var postValue='email='+email;
		
							
					var url = sitePath+'newsletter_subscription.php?'+postValue;
								
		
		            req = false;
		
		
		
		            if(window.XMLHttpRequest) {                   // branch for native XMLHttpRequest object
		
		
		
		                        try {
		
		
		
		                                    req = new XMLHttpRequest();
		
		
		
		                        } catch(e) {
		
		
		
		                                    req = false;
		
		
		
		                        }
		
		
		
		            }
		
		
		
		            else if(window.ActiveXObject) {                // branch for IE/Windows ActiveX version
		
		
		
		                        try {
		
		
		
		                                    req = new ActiveXObject("Msxml2.XMLHTTP");
		
		
		
		                        } catch(e) {
		
		
		
		                                    try {
		
		
		
		                                                req = new ActiveXObject("Microsoft.XMLHTTP");
		
		
		
		                                    } catch(e) {
		
		
		
		                                                req = false;
		
		
		
		                                    }
		
		
		
		                        }
		
		
		
		            }
		
		
		
		            if(req)
		
		
		
		            {
		
		
		
		                        
		
								req.onreadystatechange = addEmailFunction;
		
								
		
								
		
								
		
		
		
		                        req.open("GET", url, true);
		
		
		
		                        req.send(null);
		
		
		
		            }
			}
			else
			{
				alert('Please enter your email-address');
				document.getElementById('email').focus();
				return false;
			}	



}



function addEmailFunction()



{



            if(req.readyState == 4)



            {



                        var objText = req.responseText;
                        
                        document.getElementById("emailLightboxForm").innerHTML=objText;

						



             

            }



}


function call_linkCat_dropdown(SitePath,cId)
{
	if(cId!='')
	{
		var url = SitePath+'page_linkcat_dropdown.php?cat_id='+cId;
		req = false;
			var req = getObject();
		 	if(req)
		 	{
				req.onreadystatechange = show_link_cat_drop_down;
				req.open("GET", url, true);
				req.send(null);
			}
	}
	else
	{
		document.getElementById("fld_category_id").options.length = 0;
		document.getElementById("fld_category_id").options[0] = new Option('Select One','');
	}	
	
}
function show_link_cat_drop_down()
{
	if(req.readyState == 4)
	{		
		document.getElementById("waitSign").style.display = "none";
		var objXML1 = req.responseXML;
		document.getElementById("fld_category_id").options.length = 0;
		var k=objXML1.getElementsByTagName('document')[0].childNodes.length;
		
		if(req.status==200)
		{
			if(objXML1.getElementsByTagName('document')[0].childNodes.length == 0)
		 	{
				document.getElementById("fld_category_id").length = 0;
				document.getElementById("fld_category_id").options[0] = new Option("No Category",'');
	     	}
		  	else
	     	{
				document.getElementById("fld_category_id").options[0] = new Option('Select One','');
	     		for(i=0;i<k;i++)
		   		{
		   			document.getElementById("fld_category_id").options[(i+1)] = new Option(objXML1.getElementsByTagName("fld_category_name")[i].firstChild.nodeValue,objXML1.getElementsByTagName("fld_id")[i].firstChild.nodeValue);	   			
		   			
				} // End for	
	     	}
	     	document.getElementById("waitSign").style.display = "none";
			document.getElementById("fld_category_id").style.display = "block";		
	    }
        else
        {
        	alert("There was a problem retrieving data :"+req.statusText);
        }
	}
	else
	{	
		document.getElementById("waitSign").style.display = "block";
		document.getElementById("fld_category_id").style.display = "none";
		}
}


function subscribe_broadcaster(SitePath,userId,posterId,subscribed)
{
	if(subscribed==0)
	{
		
			if(userId!=0)
			{
				if(userId==posterId)
				{
					alert("Sorry, you can't subscribed yourself!");
				}
				else
				{
						if(confirm("Are you sure you want to subscribe this broadcaster?")) 
						{
							var url = SitePath+'subscribeBroadcaster.php?uId='+userId+'&posterId='+posterId;	
							
							req = false;
						
							var req = getObject();
						
						 	if(req)
						 	{
								req.onreadystatechange = subscribeBroadCaster;
								req.open("GET", url, true);
								req.send(null);
							}
						}
						else
						{
							return false;
							
						}
				}
		}
		else
		{
			
			open_login_lightBox('You must login before you can subscribe this broadcaster');
		
		}	
	}
	else
	{
		alert("Sorry, you already subscribed this video owner!");
	}		
}


function subscribeBroadCaster()
{
	if(req.readyState == 4)
	{
		
		if(req.status==200)
		{
			var div=req.responseText;
			alert("You have subscribed successfully. You will receive an email notification each time this user schedule a new broadcast.");
			document.getElementById("subscribing").innerHTML=div;
		}
		 else
        {
        	alert("There was a problem retrieving data :"+req.statusText);
        }
	}
}










	
