

function MakeHomePhoto( id ){
	
		data = 'action=home_photo&id=' + id;
		SendData( 'ajax.php', data );	
}


function DeletePhoto( id ){
	
		data = 'action=del_photo&id=' + id;
		SendData( 'ajax.php', data );	
}

function DeleteVideo( id ){
	
		data = 'action=del_video&id=' + id;
		SendData( 'ajax.php', data );	
}

function DeleteStory( id ){
	
		data = 'action=del_story&id=' + id;
		SendData( 'ajax.php', data );	
}

function ChangePrice( obj ){
	
	if( !obj ){
		
		return false;
	}
	
	if( obj.checked == true ){
		
		return true;
	}
	
	service_id = obj.id;
	ids = service_id.split('_');
	
	price_id = 'price_' + ids[1];
	
	if( $(price_id) ){
				
		$(price_id)[0].selected = true;
	}
	
	return true;
}

function BookmarkProfile( userId ){
	
		data = 'action=bookmark_profile&id=' + userId;
		SendData( 'ajax.php', data );		
}

function RemoveBookmark( userId ){
	
		data = 'action=remove_bookmark&id=' + userId;
		SendData( 'ajax.php', data );
}

function RateUser( userId, value ){
	
		data = 'action=rate_profile&profile=' + userId + '&value=' + value;
		SendData( 'ajax.php', data );			
}


function Revenue( userId, mess ){
	
		if( confirm( mess ) ){
	
			data = 'action=revenue&id=' + userId;
			SendData( 'ajax.php', data );	
		}
}


/*************************** Autocomplete Search ***************************/

function SearchNick( obj ){
	
	if( obj ){
		
		name = obj.value; 
		data = 'action=getnicks_list&nick=' + name;
		
		if( name.length > 0 ){
			SendData( 'ajax.php', data );
		}
		else{
			if( document.getElementById('contact_div') ){
				document.getElementById('contact_div').style.display = 'none';
			}
		}		
	}	
}

function GetSearchedValuesList(){
	
	if( document.getElementById('contact_div') ){
		
		cont = document.getElementById('contact_div');
	}

	if( document.getElementById('auto_complete') ){
		
		auto = document.getElementById('auto_complete');
	}	
	
	if(content){
		cont.innerHTML = content;
	}
	else{
		cont.innerHTML = '';
	}
	
	cont.style.display = 'block';
	auto.style.display = 'block';
}

/*
* @param obj -> obj with searched value
* @param id -> id of the element where searched value should be entered
*/
function TakeSerachedValue( obj, id) { 
	
	if( $(id) && obj ){
	
		$( id ).value = obj.innerHTML;
	}
	
	SetElementDisplay('contact_div', 'none');
}


function StartWebCamService( mess ){
	
	//Delete this when ret. track
	OpenChat(9);
	return true;	
	
	if( confirm( mess ) ){
		
			data = 'action=start_webcam';
			SendData( 'ajax.php', data );		
	}
}


function StopWebCamService( mess ){
	
	if( confirm( mess ) ){
		
			data = 'action=stop_webcam';
			SendData( 'ajax.php', data );		
	}	
}

function ChangeWebcamStatusHtml(){
	
	if( !$('webcam-act') ){
		
		return;
	}
	
	if(content){

		$('webcam-act').innerHTML = content;
	}
}


function CancelAccount( msg ){
	
	var res = confirm( msg );
	
	if( res ){
		
		url = "site.php?action=8";
		Redirect( url );
	}
}


function SelectService( id ){
	
	s_id = 'service_' + id;
	p_id = 'price_' + id;
	
	obj = $( s_id );
	p_obj = $( p_id );
	
	if( obj && p_obj ){
		
		if( p_obj.value != '' ){
			
			obj.checked = true;
		}
		else{
			obj.checked = false;
		}
	}
}


function GetModels( type, page, menuType ){
	
	type = parseInt( type );
	page = parseInt( page );
	menuType = parseInt( menuType );
	classType = menuType ? 'mlabel_active' : 'inner_mlabel_active';
	
	obj = $('modeltab_2');
	
	if( type <= 0 || !obj ){
		
		return false;
	}
	
	showLoadingPosition(obj, menuType);
	
	labelId = 'modeltab_' + type;
	SetElementClassName('modeltab_1', '');
	SetElementClassName('modeltab_2', '');
	SetElementClassName('modeltab_3', '');
	SetElementClassName(labelId, classType); 
	
	data = 'action=get_models&type=' + type + '&page=' + page + '&menu_type=' + menuType;
	SendData( 'ajax.php', data );	
	
	return true;
}


function GetNextModels( menuType ){
	
	if( !$('curModPage') || !$('curModTab') ){
		
		return false;
	}
	
	page = parseInt( $('curModPage').value ) + 1;
	type = parseInt( $('curModTab').value );
	
	GetModels( type, page, menuType );
	
	return true;
}


function GetPrevModels( menuType ){
	
	if( !$('curModPage') || !$('curModTab') ){
		
		return false;
	}
	
	page = parseInt( $('curModPage').value ) - 1;
	type = parseInt( $('curModTab').value );
	
	GetModels( type, page, menuType );
	
	return true;	
}
