// JavaScript Document
var http;
var idToDisplayMsg;
var urlForAjax;
var config_live_site = 'http://www.dude.com/';
//var config_live_site = 'http://192.168.51.91/dude/';
//var config_live_site = 'http://media2point0.com/';
//var config_live_site = 'http://192.168.51.2/humorsite/';

var active_best_of_section = '';

function showGirlTopImages(nextId,prevId,mode){
	idToDisplayMsg="showGirlsTopPaging";
	url = "../ajaxPages/ajaxPage.php?choice=showGirlsTopPaging&nextId="+nextId+"&prevId="+prevId+"&mode="+mode+"&mathRandomNum="+Math.random();	
	callAjaxFunction(url);
}

/**
* Show Message preview 
*/
function showMsgPreview(item_id){
	idToDisplayMsg="show_preview";
	url = "../ajaxPages/ajaxPage.php?choice=showMsgPreview&item_id="+item_id+"&mathRandomNum="+Math.random();	
	callAjaxFunction(url);
}

/**
* send adming Msg to users
*/
function sendAdminMsgToUsers(message_id, userids){
	idToDisplayMsg="show_preview";
	url = "../ajaxPages/ajaxPage.php?choice=sendAdminMsgToUsers&message_id="+message_id+"&userids="+userids+"&mathRandomNum="+Math.random();	
	callAjaxFunction(url);
}


/**
* sets winner for a feature submissions of a particular topic
*/
function set_feature_submission_winner(item_id, topic_id, topic_type, to_do, type, url_to_redirect){	

	idToDisplayMsg="ajax_msg";
	url = "../ajaxPages/ajaxPage.php?choice=set_feature_submission_winner&item_id="+item_id+"&topic_id="+topic_id+"&topic_type="+topic_type+"&mathRandomNum="+Math.random();	
	callAjaxFunction(url);
	setTimeout ("show_hide_winner_cup("+item_id+",'"+to_do+"', "+ type +", '"+ url_to_redirect +"')", 400);
}

function show_hide_winner_cup(item_id, to_do, type, url_to_redirect){	
	
	if (type == 0){
		window.location = url_to_redirect;
		return;
	}
	else{	
		switch(to_do){
			
			case 'unmark':
				document.getElementById('winner_'+item_id).innerHTML = '';
				toggle_element_visibility( 'unmark_'+item_id, true );
				toggle_element_visibility( 'mark_'+item_id, false );
				break;
			
			case 'mark':
				document.getElementById('winner_'+item_id).innerHTML = '<img src="../img/winner.gif" height="21" width="21" border="0" alt="Winner" title="This is a winner!" />';
				toggle_element_visibility( 'unmark_'+item_id, false );
				toggle_element_visibility( 'mark_'+item_id, true );			
				break;
			
			default:
				break;
		}
	}
	
	
}


function deleteAnswer(path,ansId){
	idToDisplayMsg="displayDelete"+ansId;
	url = path+"ajaxPages/ajaxPage.php?choice=deleteAnsewr&ansId="+ansId+"&mathRandomNum="+Math.random();	
	callAjaxFunction(url);
	}
function reportAbuse(path,itemId,value){
	idToDisplayMsg="showHelpful";
	//alert (itemId);
	url = path+"ajaxPages/ajaxPage.php?choice=reportAbuse&itemId="+itemId+"&value="+value+"&mathRandomNum="+Math.random();
	callAjaxFunction(url);
	}
	
function updateHelpful(path,ansId,value){
	//alert(value);
	idToDisplayMsg="showHelpful"+value+ansId;
	url = path+"ajaxPages/ajaxPage.php?choice=updateHelpful&ansId="+ansId+"&value="+value+"&mathRandomNum="+Math.random();	
	callAjaxFunction(url);
	}
function showState(path,countryId){
	idToDisplayMsg="showStateId";	
	url = path+"ajaxPages/ajaxPage.php?choice=showState&countryId="+countryId+"&mathRandomNum="+Math.random();					
	callAjaxFunction(url);
	}
function vote2Entry(path, entryId, contestCode){
	//alert(contestCode);
	idToDisplayMsg="showUpdateVote"+entryId;	
	url = path+"ajaxPages/ajaxPage.php?choice=vote4Entry&entryId="+entryId+"&mathRandomNum="+Math.random();				
	callAjaxFunction(url);	
	//alert(path+"contest/"+contestCode+"/success");
	redirect(path+"contest/"+contestCode+"/success");
	}
function voteCuteGirl(path, girlId ){
	idToDisplayMsg="showUpdateVote"+girlId;	
	document.getElementById(idToDisplayMsg).innerHTML="Processing...";
	url = path+"ajaxPages/ajaxPage.php?choice=voteCuteGirl&girlId="+girlId+"&mathRandomNum="+Math.random();				
	callAjaxFunction(url);
	redirect(path+"dudettecontest/success");
	}
	
function changeEntryApproval(contestId,newValue){
	idToDisplayMsg="showEntryApprovalMsg";		
	if(contestId==0)
		document.getElementById('contestId').value=0;
	else{
		url = "../ajaxPages/ajaxPage.php?choice=updateContestEntryApproval&newValue="+newValue+"&contestId="+contestId+"&mathRandomNum="+Math.random();			
		callAjaxFunction(url);
		}
	}
function showSkinList(advertiserId){
	if(advertiserId!=0){
		idToDisplayMsg="listBckScreen";		
		url = "../ajaxPages/ajaxPage.php?choice=showSkinList&advertiserId="+advertiserId+"&mathRandomNum="+Math.random();			
		callAjaxFunction(url);
		}
	}
	
function validateShare(){
	//alert($("#hiddenLink").val());return;
	/*$.post(config_live_site+"ajaxPages/ajaxPage.php?choice=share",{ receivers:$('#receiverEmails').val(),firstName:$('#firstname').val(),lastName:$('#lastname').val(),sender:$('#senderEmail').val(),urlLink:$('#hiddenLink').val(),rand:Math.random() } ,function(data){
	alert(data);																																																														   document.$("#").html=data;																																																						   });*/

	var error='';	
	var firstname=document.getElementById('firstname').value;
	var lastname=document.getElementById('lastname').value;
	var senderEmail=document.getElementById('senderEmail').value;
	var receivers=document.getElementById('receiverEmails').value;	
	if(firstname==''){		
		inlineMsg('firstname','Your name missing.', 2);			
		return false;	
		}
	else if(isValidEmail(senderEmail)==0){		
		inlineMsg('senderEmail','Your email missing.', 2);	
		return false;	
		}
	else if(receivers==''){		
		inlineMsg('receiverEmails','Receiver\'s Email missing.', 2);	
		return false;	
		}	
	else{
		idToDisplayMsg="showEmailField";		
		url = config_live_site+"ajaxPages/ajaxPage.php?choice=share&receivers="+receivers+"&firstName="+firstname+"&lastName="+lastname+"&sender="+senderEmail+"&mathRandomNum="+Math.random();	
		//alert(url);
		callAjaxFunction(url);
		}
	}

/*function chooseBestAnswer(answerId){
	idToDisplayMsg="displayBest";
	urlForAjax="ajaxPages/ajaxPage.php?choice=showBestAnswer&answerId="+answerId+"&mathRandomNum="+Math.random();
	callAjaxFunction(urlForAjax);
	}*/
function showNextQuestion(path,qid){
	idToDisplayMsg="displayNextQuestion";
	urlForAjax=path+"ajaxPages/ajaxPage.php?choice=showNextQuestion&qid="+qid+"&mathRandomNum="+Math.random();	
	callAjaxFunction(urlForAjax);	
	}

<!--FOR QUESTION CATEGORY LISTING-->
function showSubCat(catId,path,showHide){		
	if(catId!=0){
		idToDisplayMsg="showSubCat";
		urlForAjax = path+"ajaxPages/ajaxPage.php?choice=showSubCat&showHide="+showHide+"&catId="+catId+"&mathRandomNum="+Math.random();	
		
		callAjaxFunction(urlForAjax);	
		
	}
	else{		
		document.getElementById('showSubCat').innerHTML="<input type='hidden' id='subCat' name='subCat' value=''/><input type='text' id='txtSubCat' name='txtSubCat' value='' />";
		}
}

function showFeatureSubCat(catId,path,showHide){		
	if(catId!=0){
		idToDisplayMsg="showSubCat";
		urlForAjax = path+"ajaxPages/ajaxPage.php?choice=showFeatureSubCat&showHide="+showHide+"&catId="+catId+"&mathRandomNum="+Math.random();	
		
		callAjaxFunction(urlForAjax);	
		
	}
	else{		
		document.getElementById('showSubCat').innerHTML="<input type='hidden' id='subCat' name='subCat' value=''/><input type='text' id='txtSubCat' name='txtSubCat' value='' />";
		}
}



<!--END OF QUESTION LISTING-->

function showItemsForCategory(categoryId){
	if(categoryId!=0){
		idToDisplayMsg="show-list";			
		url = "../ajaxPages/ajaxPage.php?choice=showList&categoryId="+categoryId+"&mathRandomNum='"+Math.random()+"'";	
		callAjaxFunction(url);

		}
	}
/*function showSubCat(parentName,childName, parentId,path){	
	if(parentId!=0){
		idToDisplayMsg="show"+parentName;	
		urlForAjax = path+"/ajaxPages/ajaxPage.php?choice=showSubCat&parentId="+parentId+"&mathRandomNum="+Math.random();	
		callAjaxFunction(urlForAjax);	
		document.getElementById('showLocation').innerHTML="<input type='text' id='txtLocation' name='txtLocation' value='' class='logininput' />";
	}
	else{		
		document.getElementById('showCity').innerHTML="<input type='hidden' id='"+parentName+"' name='"+parentName+"' value='' class='logininput' /><input type='text' id='txt"+parentName+"' name='txt"+parentName+"' value=''  class='logininput' />";
		document.getElementById('show'+childName).innerHTML="<input type='text' id='txt"+childName+"' name='txt"+childName+"' value=''  class='logininput' />";
		}
}*/
function showBestOfSectionOnSort(fullpath, orderBy){
	
	//var page=document.getElementById('tab-title').innerHTML.toLowerCase();
	idToDisplayMsg="best-of-section";
	url = fullpath+"ajaxPages/ajaxPage.php?choice=changeBestOfSection&page="+page+"&orderBy="+orderBy+"&mathRandomNum='"+Math.random()+"'";		
	callAjaxFunction(url);
}
	
function showBestOfSection(fullpath, page, tabbgcolor){
	
	active_best_of_section = page;
	if(page=='dudettes')
		document.getElementById('tab-title').innerHTML='DUDETTES';
	else	
		document.getElementById('tab-title').innerHTML=page.toUpperCase();
		
	if(page=='contest' || page=='question' || page=='dudettes' || page=='games')
		document.getElementById('highestRatedId').innerHTML='MOST VIEWED';
	else
		document.getElementById('highestRatedId').innerHTML='HIGHEST RATED';
	
	
	idToDisplayMsg="best-of-section";				
	url = fullpath+"ajaxPages/ajaxPage.php?choice=changeBestOfSection&page="+page+"&mathRandomNum='"+Math.random()+"'";		
	callAjaxFunction(url);
}

/* --------------------------------------------------------------------------------------------------------------------	*
 * SEND ADD TO FRIEND REQUEST EMAIL																						*
 * -------------------------------------------------------------------------------------------------------------------- */
function sendAddToFriendRequest(sender_id, receiver_id){	
	idToDisplayMsg="user_ajax_msg";			
	url = "../ajaxPages/ajaxPage.php?choice=sendAddToFriendRequest&sender_id="+sender_id+"&receiver_id="+receiver_id+"&mathRandomNum='"+Math.random()+"'";	
	callAjaxFunction(url);
}

/* --------------------------------------------------------------------------------------------------------------------	*
 * SHOW ALL FRIEND LIST OF CURRENT USER IN PROFILE PAGE																	*
 * -------------------------------------------------------------------------------------------------------------------- */
function showAllFriends(user_id){
	
	idToDisplayMsg="all_friends_container";	
	document.getElementById('recent_friends_container').innerHTML = '';
	url = "../ajaxPages/ajaxPage.php?choice=showAllFriends&user_id="+user_id+"&mathRandomNum='"+Math.random()+"'";		
	callAjaxFunction(url);
}



/* --------------------------------------------------------------------------------------------------------------------	*
 * SHOW CONTRIBUTIONS DETAIL OF A USER OF A CATEGORY																		*
 * -------------------------------------------------------------------------------------------------------------------- */
function showContributionDetails(itemCategory, user_id){	

	idToDisplayMsg="show_contribution_detail";			
	url = "../ajaxPages/ajaxPage.php?choice=showContributionDetails&itemCategory="+itemCategory+"&user_id="+user_id+"&mathRandomNum='"+Math.random()+"'";
	callAjaxFunction(url);
}

/* --------------------------------------------------------------------------------------------------------------------	*
 * SHOW ACTIVITIES DETAIL OF A USER OF A CATEGORY																		*
 * -------------------------------------------------------------------------------------------------------------------- */
function showUserActivities(activity, userid){	
	idToDisplayMsg="show_activity_detail";			
	url = "../ajaxPages/ajaxPage.php?choice=showUserActivities&activity="+activity+"&userid="+userid+"&mathRandomNum='"+Math.random()+"'";	
	callAjaxFunction(url);
}

/* --------------------------------------------------------------------------------------------------------------------	*
 * FLAG COMMENT OR REVIEW OF AN ITEM																					*
 * -------------------------------------------------------------------------------------------------------------------- */
function flagComment(fullpath, reviewID, itemURL){	
	idToDisplayMsg="flag_msg_"+reviewID;			
	url = fullpath + "ajaxPages/ajaxPage.php?choice=updateReviewFlag&reviewID="+reviewID+"&itemURL="+itemURL+"&mathRandomNum='"+Math.random()+"'";	
	callAjaxFunction(url);
}


function getLiking(fullpath,categoryId,itemId){
	idToDisplayMsg="likeValue";
	url = fullpath+"ajaxPages2/ajaxPage.php?choice=getLiking&categoryId="+categoryId+"&itemId="+itemId+"&mathRandomNum="+Math.random();	
	callAjaxFunction(url);
}

function getDisliking(fullpath,categoryId,itemId){
	idToDisplayMsg="likeValue";
	url = fullpath+"ajaxPages/ajaxPage2.php?choice=getDisliking&categoryId="+categoryId+"&itemId="+itemId+"&mathRandomNum="+Math.random();	
	callAjaxFunction(url);
}
	
function checkEmailExists(fullpath,email,type){
	
	idToDisplayMsg="emailExistsId";
	
	if(email==''){
		inlineMsg('txtEmail','Email missing.',2);	
		document.getElementById('txtEmail').focus();
		return false;
	}
	
	if( isValidEmail(email) == 0 ) {	  
		inlineMsg('txtEmail', 'Invalid email address.',2);
		document.getElementById('txtEmail').focus();
		return false;
	}
	
	url = fullpath+"ajaxPages/ajaxPage.php?choice=checkEmail&emailAdd="+email+"&type="+type+"&mathRandomNum="+Math.random();	
	callAjaxFunction(url);
}

function checkUserExists(fullpath,username,type){
	idToDisplayMsg="userExistsId";	
	if(username==''){
		inlineMsg('txtUser','Username missing.',2);	
		document.getElementById('txtUser').focus();
		return false;
		}
	else{
		url = fullpath+"ajaxPages/ajaxPage.php?choice=checkUsername&username="+username+"&type="+type+"&mathRandomNum="+Math.random();	
		callAjaxFunction(url);
		}
	}
	
function addLiking(fullpath,categoryId,itemId){	
	idToDisplayMsg="showUpdateLike-"+itemId;
	url = fullpath+"ajaxPages/ajaxPage2.php?choice=updateLiking&categoryId="+categoryId+"&itemId="+itemId+"&mathRandomNum="+Math.random();
	callAjaxFunction(url);	
	setTimeout ("getLiking('"+fullpath+"','"+categoryId+"','"+itemId+"')", 400);
}

function addDisliking(fullpath,categoryId,itemId){	
	idToDisplayMsg="showUpdateDislike-"+itemId;;			
	url = fullpath+"ajaxPages/ajaxPage2.php?choice=updateDisliking&categoryId="+categoryId+"&itemId="+itemId+"&mathRandomNum="+Math.random();	
	callAjaxFunction(url);	
	setTimeout ("getDisliking('"+fullpath+"','"+categoryId+"','"+itemId+"')", 400);
}

/**
* ITEM LIKING FROM ITEM'S GENERAL LISTING PAGE. esp for hotlinks/newslinks	
*/
function update_item_liking(fullpath, categoryId, itemId ){	

	idToDisplayMsg="like_msg_"+itemId;			
	url = fullpath+"ajaxPages/ajaxPage.php?choice=update_item_liking&categoryId="+categoryId+"&itemId="+itemId+"&mathRandomNum="+Math.random();	
	//document.getElementById('showUpdateLike').style.display='';
	callAjaxFunction(url);	
	setTimeout ("get_item_liking_value('"+fullpath+"','"+categoryId+"','"+itemId+"')", 400);
}

function get_item_liking_value(fullpath,categoryId,itemId){
	//alert(fullpath);
	idToDisplayMsg="like_value_" + itemId;
	url = fullpath+"ajaxPages/ajaxPage.php?choice=getLiking&categoryId="+categoryId+"&itemId="+itemId+"&mathRandomNum="+Math.random();	
	callAjaxFunction(url);
}
	
/* ----------------------------------------------------------------------------------------------------	*
 * 									UPDATE REVIEW APPROVAL SETTING FOR AN ITEM							*
 * ---------------------------------------------------------------------------------------------------- */
function changeReviewApproval(itemID, itemDBTable, approvalStatus){
	idToDisplayMsg="showUpdateReviewApproval";			
	url = "../ajaxPages/ajaxPage.php?choice=updateReviewApproval&itemID="+itemID+"&itemDBTable="+itemDBTable+"&approvalStatus="+approvalStatus+"&mathRandomNum='"+Math.random()+"'";		
	callAjaxFunction(url);
}

function changecontent(idToshow,divName){
	idToDisplayMsg=idToshow;
	urlForAjax = "ajaxPages/ajaxPage.php?choice=showDiv&divName="+divName+"&mathRandomNum="+Math.random();			
	callAjaxFunction(urlForAjax);
}
function ajaxPaging(){
	idToDisplayMsg="showSubCategory";
	urlForAjax = "ajaxPages/ajaxPage.php?choice=showSubCategory&categoryId="+categoryId+"&mathRandomNum="+Math.random();			
	callAjaxFunction(urlForAjax);
	}
	
function changeContestSubCat(path, CatId, showHide){	
		idToDisplayMsg="idforContestSubCat";	
		urlForAjax = path+"ajaxPages/ajaxPage.php?choice=showContestSubCat&CatId="+CatId+"&showHide="+showHide+"&mathRandomNum="+Math.random();			
		callAjaxFunction(urlForAjax);		
}	

/* ------------------------------------------------------------------------------------------------ *
 * This function will be used to both track the impression of Visit our Prtner and Background Skin	*
 * ------------------------------------------------------------------------------------------------ */
function trackPartnersImpression(){
	idToDisplayMsg='';
	urlForAjax = config_live_site+"ajaxPages/ajaxPage.php?choice=trackPartnerImpression&mathRandomNum="+Math.random();			
	callAjaxFunction(urlForAjax);
}

var trackImpressionOfPartners = new trackPartnersImpression();  // each time the page is loaded, impressions of all active partners is updated



/* ------------------------------------------------------------------------------------------------	*
 * seting skin for a particular page																*		
 * ------------------------------------------------------------------------------------------------ */
function setSkinForThisPage(skinID, page){
	idToDisplayMsg='ajaxDiv'+page;		
	urlForAjax = "../ajaxPages/ajaxPage.php?choice=setSkinForThisPage&skinID="+skinID+"&page="+page+"&mathRandomNum="+Math.random();		
	callAjaxFunction(urlForAjax);
}



/* ------------------------------------------------------------------------------------------------	*
 * review reply of an item																			*		
 * ------------------------------------------------------------------------------------------------ */
function replyReview(fullpath, form, msgDiv){
	
	idToDisplayMsg = msgDiv;	
	var parent_id = form.parent_id.value;
	var review_for_id = form.review_for_id.value;
	var review_category = form.review_category.value;
	var reviewed_by = form.reviewed_by.value;
	var content = form.content.value;
	var status = form.status.value;
	
	var contentID = 'reply_field_'+ parent_id;
	if(document.getElementById(contentID).value==''){
		inlineMsg(contentID,'Reply content missing.',2);
		return false;
	}
	var formDivID = 'review_reply_' + parent_id;
	
	urlForAjax = fullpath + "ajaxPages/ajaxPage.php?choice=replyReview&parent_id="+parent_id+"&review_for_id="+review_for_id+"&review_category="+review_category+"&reviewed_by="+reviewed_by+"&content="+encodeURI(content)+"&status="+status+"&mathRandomNum="+Math.random();		
	callAjaxFunctionWithDivToHide(urlForAjax, formDivID);
}

/* ------------------------------------------------------------------------------------------------	*
 * VIEW MORE COMMENTS OF A PARENT REVIEW: other than first default 3 comments																*		
 * ------------------------------------------------------------------------------------------------ */
function viewMoreComments(fullpath, parentReviewID, styleString, itemURL){		
	idToDisplayMsg='more_comments_' + parentReviewID;
	urlForAjax = fullpath + "ajaxPages/ajaxPage.php?choice=viewMoreComments&parentReviewID="+parentReviewID+"&bgStyle="+styleString+"&itemURL="+itemURL+"&mathRandomNum="+Math.random();	
	
	var idToHide = 'link_more_comment_' + parentReviewID;
	callAjaxFunctionWithDivToHide(urlForAjax, idToHide);
}


/* ------------------------------------------------------------------------------------------------	*
 * review reply of an item																			*		
 * ------------------------------------------------------------------------------------------------ */
function replyOnSentMessage(form){
	
	idToDisplayMsg = "success_msg";			
				
	// unhide the message div
	document.getElementById('success_msg').style.display = 'block';
	
	var parent_id = form.parent_id.value;
	var sender_id = form.sender_id.value;
	var receiver_id = form.receiver_id.value;
	var message = form.message.value;
	
	var contentID = 'reply_field_'+parent_id;
	if(document.getElementById(contentID).value==''){
		inlineMsg(contentID,'Reply content missing.',2);
		return false;
	}
	var formDivID = 'msg_reply';
	
	urlForAjax = "../ajaxPages/ajaxPage.php?choice=replyOnSentMessage&parent_id="+parent_id+"&sender_id="+sender_id+"&receiver_id="+receiver_id+"&message="+encodeURI(message)+"&mathRandomNum="+Math.random();	
	
	callAjaxFunctionWithDivToHide(urlForAjax, formDivID);
}


/* ----------------------------------------------------------------------------------------------------	*
 * 	DELETE A MESSAGE FROM INBOX/SENT																	*
 * ---------------------------------------------------------------------------------------------------- */
function deleteMsg(msg_id, type, hasDivToHide){
	if(confirm('Are you sure you want to delete this message?')){	
		
		idToDisplayMsg = "success_msg";			
				
		// unhide the message div
		document.getElementById('success_msg').style.display = 'block';
		
		url = "../ajaxPages/ajaxPage.php?choice=deleteMsg&msg_id="+msg_id+"type="+type+"&mathRandomNum='"+Math.random()+"'";		
		
		if(hasDivToHide){
			var idToHide = 'message_container';
			callAjaxFunctionWithDivToHide(url, idToHide);
		}
		else{
			callAjaxFunction(url);	
		}
	}
	return false;
}

/* ----------------------------------------------------------------------------------------------------	*
 * 	SEARCH USER BY NAME: /messages																		*
 * ---------------------------------------------------------------------------------------------------- */
function searchUserByName(username){	
	idToDisplayMsg = "user_result_container";			
	url = "../ajaxPages/ajaxPage.php?choice=searchUserByName&username="+username+"&mathRandomNum='"+Math.random()+"'";		
	callAjaxFunction(url);	
}

/* ----------------------------------------------------------------------------------------------------	*
 * 	UPDATE MESSAGE SETTINGS OF CURRENT  USER: /messages													*
 * ---------------------------------------------------------------------------------------------------- */
function updateMessageSetting(form){	
	
	var emailOnNewMsg = form.emailOnNewMsg.checked ? '1' : '0' ;
	var emailOnReply = form.emailOnReply.checked ? '1' : '0';
	
	idToDisplayMsg = "settings_result_container";			
	url = "../ajaxPages/ajaxPage.php?choice=updateMessageSetting&emailOnNewMsg="+emailOnNewMsg+"&emailOnReply="+emailOnReply+"&mathRandomNum='"+Math.random()+"'";		
	callAjaxFunction(url);	
}


function callAjaxFunctionWithDivToHide(url, idToHide){			
	http=null;
	http = getHTTPObject();				
	http.open("GET", url , true);	
	http.onreadystatechange = function (){		
		if(idToDisplayMsg != ''){		
			var docEle=eval("document.getElementById('"+idToDisplayMsg+"')");			
			if( http.readyState == 4){
				showHide(idToHide);
				docEle.innerHTML = http.responseText;
			}
			else{						
				docEle.innerHTML="<img src='" + config_live_site +"'img/lightbox-ico-loading.gif' width='20px' height='20px' />";
				
			}
		}
	};	
	
	http.send(null);
}



function callAjaxFunction(url){		
	http=null;
	http = getHTTPObject();				
	http.open("GET", url , true);	
	http.onreadystatechange = stateChanged;	
	http.send(null);
}

function stateChanged(){		
	if(idToDisplayMsg != ''){
		
		var docEle=eval("document.getElementById('"+idToDisplayMsg+"')");			
		if( http.readyState == 4){			
			//alert(trimAll(http.responseText));			
			docEle.innerHTML=(http.responseText);			
		}
		else{						
			docEle.innerHTML="Requesting ...<img src='" + config_live_site +"img/lightbox-ico-loading.gif' width='20px' height='20px' />";						
		}
	}
}

function getHTTPObject() {
	
	try{ return new XMLHttpRequest(); } catch (e)
	{
		try{ return new ActiveXObject("Msxml2.XMLHTTP"); } catch (e)    
		{
			try{ return new ActiveXObject("Microsoft.XMLHTTP");} catch (e)
			{
				alert("Your browser does not support AJAX!");
				return null;
			}
		}
	}
	
}