// JavaScript Document
function loginchk(Myfrm)
{
	
	if(Myfrm.username.value =="")
	{
		alert("Enter UserName");
		//myfrm.logname.focus();
		return false;
	}
	
	if(Myfrm.password.value == "")
	{
		alert("Enter Password");
		//myfrm.passwrd.focus();
		return false;
	}
	
	Myfrm.hdLogin.value =1;	
	//Myfrm.action="postproperty.php";
	//Myfrm.submit();
}

function showobject()
{
	document.getElementById('object1').style.visibility = 'visible';
	document.getElementById('td_sign').style.backgroundColor='#FFFFFF';
	document.getElementById('an').style.color='#333333';	
	document.searchres.disabled = true;
}
function hideobject2()
{
	document.searchres.disabled = false;
	document.getElementById('object1').style.visibility = 'hidden';
	document.getElementById('td_sign').style.backgroundColor='';
	document.getElementById('an').style.color='#FFFFFF';
}
var initialtab=[1, "sc1"]
function cascadedstyle(el, cssproperty, csspropertyNS){
if (el.currentStyle)
return el.currentStyle[cssproperty]
else if (window.getComputedStyle){
var elstyle=window.getComputedStyle(el, "")
return elstyle.getPropertyValue(csspropertyNS)
}
}
var previoustab=""
function expandcontent(cid, aobject){
if (document.getElementById){
highlighttab(aobject)
detectSourceindex(aobject)
if (previoustab!="")
document.getElementById(previoustab).style.display="none"
document.getElementById(cid).style.display="block"
previoustab=cid
if (aobject.blur)
aobject.blur()
return false
}
else
return true
}
function highlighttab(aobject){
if (typeof tabobjlinks=="undefined")
collecttablinks()
for (i=0; i<tabobjlinks.length; i++)
tabobjlinks[i].style.backgroundColor=initTabcolor
var themecolor=aobject.getAttribute("theme")? aobject.getAttribute("theme") : initTabpostcolor
aobject.style.backgroundColor=document.getElementById("tabcontentcontainer").style.backgroundColor=themecolor
}
function collecttablinks(){
var tabobj=document.getElementById("tablist")
tabobjlinks=tabobj.getElementsByTagName("A")
}
function detectSourceindex(aobject){
for (i=0; i<tabobjlinks.length; i++){
if (aobject==tabobjlinks[i]){
tabsourceindex=i //source index of tab bar relative to other tabs
break
}
}
}
function do_onload(){
if(document.forms[0].invalid_user_err_msg.value == 'Invalid Login')
{
		showobject();
}
var cookiename=(typeof persisttype!="undefined" && persisttype=="sitewide")? "tabcontent" : window.location.pathname
var cookiecheck=window.get_cookie && get_cookie(cookiename).indexOf("|")!=-1
collecttablinks()
initTabcolor=cascadedstyle(tabobjlinks[1], "backgroundColor", "background-color")
initTabpostcolor=cascadedstyle(tabobjlinks[0], "backgroundColor", "background-color")
if (typeof enablepersistence!="undefined" && enablepersistence && cookiecheck){
var cookieparse=get_cookie(cookiename).split("|")
var whichtab=cookieparse[0]
var tabcontentid=cookieparse[1]
expandcontent(tabcontentid, tabobjlinks[whichtab])
}
else
expandcontent(initialtab[1], tabobjlinks[initialtab[0]-1])
}
if (window.addEventListener)
window.addEventListener("load", do_onload, false)
else if (window.attachEvent)
window.attachEvent("onload", do_onload)
else if (document.getElementById)
window.onload=do_onload
 

 
var enablepersistence=true //true to enable persistence, false to turn off (or simply remove this entire script block).
var persisttype="local" //enter "sitewide" for Tab content order to persist across site, "local" for this page only
function get_cookie(Name) { 
var search = Name + "="
var returnvalue = "";
if (document.cookie.length > 0) {
offset = document.cookie.indexOf(search)
if (offset != -1) { 
offset += search.length
end = document.cookie.indexOf(";", offset);
if (end == -1) end = document.cookie.length;
returnvalue=unescape(document.cookie.substring(offset, end))
}
}
return returnvalue;
}
function savetabstate(){
var cookiename=(persisttype=="sitewide")? "tabcontent" : window.location.pathname
var cookievalue=(persisttype=="sitewide")? tabsourceindex+"|"+previoustab+";path=/" : tabsourceindex+"|"+previoustab
document.cookie=cookiename+"="+cookievalue
}
window.onunload=savetabstate;
 

function CheckAtleastOneCharacter()
{
	frm=document.searchres;
	frm.searchhidden.value=1;
	frm.action="search.php";
}
 

 
function check(searchres)
{
   if ((searchres.searchkeyword.value == "")||(searchres.searchkeyword.value=="Search the network")) 
   {
    alert( "Please Enter the Search the network" );
   searchres.searchkeyword.focus();
    return false ;
  }
   return true ;
}
function removebox1(value)
{ 
if(value == "Search the network")
{
alert.removebox;
document.searchres.searchkeyword.value="";
document.searchres.searchkeyword.focus();
}
}
function showbox1(value)
{
if(value == "Search the network")
{
if(document.searchres.searchkeyword.value=="")
{
document.searchres.searchkeyword.value="Search the network";
document.searchres.searchkeyword.focus();
}
}
}
 
 
expandcollapse.addDiv('expcollapse', 'fade=1,speed=1000,height=200px')
expandcollapse.ontoggle=function($, divobj, state){ 
}
expandcollapse.init();
 
 
 
function mouse_over1(id)
{
	document.getElementById("ranking").className="mouseover";
	document.getElementById("ranking").style.color="#000000";
}
function mouse_out1(id)
{
	document.getElementById("ranking").className="active";
	document.getElementById("ranking").style.color="#000000";
}
function mouse_over_ranking1(id)
{
	document.getElementById("ranking1").className="mouseover";
	document.getElementById("ranking1").style.color="#000000";
}
function mouse_out_ranking1(id)
{
	document.getElementById("ranking1").className="active";
	document.getElementById("ranking1").style.color="#000000";
}
 
 
function mouse_over2(id)
{
document.getElementById("tournaments").className="mouseover";
document.getElementById("tournaments").style.color="#000000";
}
function mouse_out2(id)
{
	document.getElementById("tournaments").className="active";
	document.getElementById("tournaments").style.color="#000000";
}
 
 
function mouse_over3(id)
{
	document.getElementById("mail1").className="mouseover";
	document.getElementById("mail1").style.color="#000000";
}
function mouse_out3(id)
{
	document.getElementById("mail1").className="active";
	document.getElementById("mail1").style.color="#000000";
}
 
 
function mouse_over4(id)
{
	document.getElementById("account1").className="mouseover";
	document.getElementById("account1").style.color="#000000";
}
function mouse_out4(id)
{
	document.getElementById("account1").className="active";
	document.getElementById("account1").style.color="#000000";
}
 
 
function mouse_over5(id)
{
	document.getElementById("profile1").className="mouseover";
	document.getElementById("profile1").style.color="#000000";
}
function mouse_out5(id)
{
	document.getElementById("profile1").className="active";
	document.getElementById("profile1").style.color="#000000";
}
 
 
function mouse_over6(id)
{
	document.getElementById("tournaments1").className="mouseover";
	document.getElementById("tournaments1").style.color="#000000";
}
function mouse_out6(id)
{
	document.getElementById("tournaments1").className="active";
	document.getElementById("tournaments1").style.color="#000000";
}
 
 
function mouse_over7(id)
{
	document.getElementById("today1").className="mouseover";
	document.getElementById("today1").style.color="#000000";
}
function mouse_out7(id)
{
	document.getElementById("today1").className="active";
	document.getElementById("today1").style.color="#000000";
}
 
 
function mouse_over8(id)
{
	document.getElementById("today").className="mouseover";
	document.getElementById("today").style.color="#000000";
}
function mouse_out8(id)
{
	document.getElementById("today").style.background="";
	document.getElementById("today").style.color="#000000";
}
function mouse_over9(id)
{
	document.getElementById("store").className="mouseover";
	document.getElementById("store").style.color="#000000";
}
function mouse_out9(id)
{
document.getElementById("store").className="active";
document.getElementById("store").style.color="#000000";
}
function mouse_over_forum(id)
{
	document.getElementById("forum").className="mouseover";
	document.getElementById("forum").style.color="#000000";
}
function mouse_out_forum(id)
{
	document.getElementById("forum").className="active";
	document.getElementById("forum").style.color="#000000";
}
function mouse_over_forum1(id)
{
	document.getElementById("forum1").className="mouseover";
	document.getElementById("forum1").style.color="#000000";
}
function mouse_out_forum1(id)
{
	document.getElementById("forum1").className="active";
	document.getElementById("forum1").style.color="#000000";
}
function mouse_over10(id)
{
	document.getElementById("news").className="mouseover";
	document.getElementById("news").style.color="#000000";
}
function mouse_out10(id)
{
document.getElementById("news").className="active";
document.getElementById("news").style.color="#000000";
}
 

 
function check ( searchres )
{
   if ((searchres.searchkeyword.value == "")||(searchres.searchkeyword.value=="Search the network")) 
   {
    alert( "Please Enter Keywords Into The Search Field" );
   searchres.searchkeyword.focus();
    return false ;
  }
    return true ;
}
function removebox1(value)
{ 
if(value == "Search the network")
{
alert.removebox;
document.searchres.searchkeyword.value="";
document.searchres.searchkeyword.focus();
}
}
function showbox1(value)
{
if(value == "Search the network")
{
if(document.searchres.searchkeyword.value=="")
{
document.searchres.searchkeyword.value="Search the network";
document.searchres.searchkeyword.focus();
}
}
}


function hidetournament(id){

	document.getElementById('tab01').style.display ='none';
	document.getElementById('tab02').style.display ='none';
	document.getElementById('tab03').style.display ='none';
	document.getElementById(id).style.display ='block';

}

function returntoedit()
{
document.accounthome.action="http://www.pongleague.com/editprofile.php";
//document.frm.submit();
}
function RequestFriends(friend)
{

	frm=document.accounthome;
	//alert(friend);
	
	frm.friendid.value=friend;
	frm.hdusertype.value=1;
	frm.action="http://www.pongleague.com/accounthome.php?userId="+friend+"&des="+1;
	frm.submit();
}


function delet(teamid,userid)
{
	frm=document.accounthome;
	frm.team_id.value=teamid;
	frm.action="accounthome.php?userId="+userid;
	frm.submit();
}

$(function() {
//-------------- Update Button-----------------


$(".search_button").click(function() {
    var search_word = $("#search_box").val();
    var dataString = 'search_word='+ search_word;
	
	if(search_word=='')
	{
	}
	else
	{
	$.ajax({
	type: "GET",
    url: "searchteam.php",
    data: dataString,
    cache: false,
    beforeSend: function(html) {
   
	document.getElementById("insert_search").innerHTML = ''; 
	$("#flash").show();
	$("#searchword").show();
	 $(".searchword").html(search_word);
	$("#flash").html('<img src="http://www.pongleague.com/images/loading.gif" align="center">');
	
	
               
            },
  success: function(html){
   $("#insert_search").show();
  
   $("#insert_search").append(html);
   $("#flash").hide();
	
  }
});
		
	}
		

    return false;
	});
//---------------- Delete Button----------------


});
