	function hoverTab(tabData){
		tabData.style.backgroundPosition = " 0% -50px";
		tabData.style.lineHeight = "24px";
	}
	
	function outTab(tabData){
		tabData.style.backgroundPosition = " 0% -25px";
	}
	
	function executeTab(tabData){
		tabData.className = "tabactive";
		tabData.style.backgroundPosition = " 0% -0px";
		tabData.onmouseover=function(){};
		tabData.onmouseout=function(){};
	}
	
	function showTabData(idForDisplay){
		var tabFeatured = document.getElementById('tab-featured'); 
		var tabToprated = document.getElementById('tab-toprated');
		var tabMostview = document.getElementById('tab-mostview');
		
		var featuretab = document.getElementById('featuretab');
		var topratedtab = document.getElementById('topratedtab');
		var mostviewedtab = document.getElementById('mostviewedtab');
		
		tabFeatured.style.display = "none";
		tabToprated.style.display = "none";
		tabMostview.style.display = "none";
		 
		featuretab.className = "";
		topratedtab.className = "";
		mostviewedtab.className = "";
		
		/*featuretab.style.backgroundPosition = " 0% -25px";
		topratedtab.style.backgroundPosition = " 0% -25px";
		mostviewedtab.style.backgroundPosition = " 0% -25px";
		
		featuretab.onmouseover=function(){hoverTab(this);}
		topratedtab.onmouseover=function(){hoverTab(this);}
		mostviewedtab.onmouseover=function(){hoverTab(this);}
		
		featuretab.onmouseout=function(){outTab(this);}
		topratedtab.onmouseout=function(){outTab(this);}
		mostviewedtab.onmouseout=function(){outTab(this);}*/
		
		if (idForDisplay == "featured"){	
			tabFeatured.style.display = "block";
			executeTab(featuretab);
		}			
		else if(idForDisplay == "toprated"){
			tabToprated.style.display = "block";
			executeTab(topratedtab);			
		}
		else if(idForDisplay == "mostview"){
			tabMostview.style.display = "block";
			executeTab(mostviewedtab);
		}
		
 	}
	
function showTabData2(idForDisplay){
		var tabTW = document.getElementById('tab-topwatched'); 
		var tabR = document.getElementById('tab-recently');
		
		var topwatchedtab = document.getElementById('topwatchedtab');
		var recentlytab = document.getElementById('recentlytab');
		
		tabTW.style.display = "none";
		tabR.style.display = "none";
		 
		topwatchedtab.className = "";
		recentlytab.className = "";
		
		if (idForDisplay == "top"){	
			tabTW.style.display = "block";
			executeTab(topwatchedtab);
		}			
		else if(idForDisplay == "recently"){
			tabR.style.display = "block";
			executeTab(recentlytab);			
		}
		
 	}
	
function validatecomment(){
	var comment_value=document.getElementById('txtComments').value;
	
	if(comment_value==''){
			alert(' Comment box is empty !!');
			return false;
		}else{
			return true;	
		}
	}
	
function clearsearch(){
		var searchval = document.getElementById('search_id').value;
		if(searchval=='Search Here')
		document.getElementById('search_id').value='';
	}
	
function fillsearch(){
		var searchval = document.getElementById('search_id').value;
		if(searchval=='')
		document.getElementById('search_id').value='Search Here';
	}
	
function clearusername(){
		var searchval = document.getElementById('username').value;
		if(searchval=='Username')
		document.getElementById('username').value='';
	}
	
function fillusername(){
		var searchval = document.getElementById('username').value;
		if(searchval==''){
		document.getElementById('username').value='Username';
		
		}
	}
	
function clearpassword(){
		var searchval = document.getElementById('password').value;
		if(searchval=='Password'){
		document.getElementById('password').type='password';
		document.getElementById('password').value='';
		}
	}
	
function fillpassword(){
		var searchval = document.getElementById('password').value;
		if(searchval==''){
		document.getElementById('password').value='Password';
		document.getElementById('password').type='text';
		}
	}	

// Used to process login by doing authentication and checking to see what should
// happen next via returned JSON
function processLogin(eventObject) {
	
	jQuery.post(
		'gigya.php',
		{
			'gigya-authenticate':1,
			'gigya-timestamp':eventObject.timestamp,
			'gigya-uid':eventObject.UID,
			'gigya-signature':eventObject.signature,
			'gigya-is-site-user':eventObject.user.isSiteUser,
			'gigya-is-log-in-identity':eventObject.user.isLogInIdentity,
			'gigya-is-connected':eventObject.user.isConnected,
			'gigya-nickname':eventObject.user.nickname,
			'gigya-login-provider':eventObject.user.loginProvider,
			'gigya-photo-url':eventObject.user.photoURL,
			'gigya-thumbnail-url':eventObject.user.thumbnailURL,
			'gigya-first-name':eventObject.user.firstName,
			'gigya-last-name':eventObject.user.lastName,
			'gigya-gender':eventObject.user.gender,
			'gigya-age':eventObject.user.age,
			'gigya-birth-day':eventObject.user.birthDay,
			'gigya-birth-month':eventObject.user.birthMonth,
			'gigya-birth-year':eventObject.user.birthYear,
			'gigya-email':eventObject.user.email,
			'gigya-country':eventObject.user.country,
			'gigya-state':eventObject.user.state,
			'gigya-city':eventObject.user.city,
			'gigya-zip':eventObject.user.zip,
			'gigya-profile-url':eventObject.user.profileURL,
			'redirect-url':'http://www.ippio.com/gigya.php'
		},
		function(data, textStatus) {
			jQuery('#componentDiv').html(data.message);
			if( '' != data.redirect ) {
				setTimeout( 'window.document.location.href = "' + data.redirect + '";', 150 );
			}
		},
		'json'
	);
}
