var ROOT = "";

/**************************************************** AJAX ******************************************************************************/
MyXssMagic = new function() 
{  
  
  this.serverResponse = function(data) 
  {
    if(data != "Empty")
    {
		var div = document.getElementById(ROOT);    
		div.innerHTML = data;
    }
  }     
}
function sayHello()
{
alert('hello');
}
 
function ajax_do(url) 
{		
	var jsel = document.createElement('SCRIPT');
	jsel.type = 'text/javascript';		
	jsel.src = url;		
	if (window.XMLHttpRequest) 
    {
		document.getElementsByTagName('head')[0].appendChild(jsel);
	}
	
}
/**************************************************** AJAX ******************************************************************************/


// Para el request de documentos XML
var req;
/********************************************* MODULE RANKING WINDOW LINK - CALL BACK (STATIC AND DYNAMIC) ******************************/
// Obtiene un documento XML a partir del URL pasado
function LoadPageStaticXML(url) 
{
    // Determina si existe el objeto XMLHttpRequest        
    if (window.XMLHttpRequest) 
    {
		// Crea el nuevo objeto
        req = new XMLHttpRequest();       
    }
    else
    {
		req = new ActiveXObject("Microsoft.XMLHTTP");
    }
    
    if(req != null)
    {
		// Cuando el documento está listo, invoca a la función Procesar
        req.onreadystatechange = processStatic;
		// Asigna el método, el URL y demás parámetros
        req.open("GET", url, true);
		// Envía el pedido
        req.send(null);
    }   
}

function LoadPageDynamicXML(url) 
{  //alert("d2 : " +url);
    try 
	{
		req = new ActiveXObject("Msxml2.XMLHTTP");
	} 
	catch (e) 
	{
		try 
		{
			req = new ActiveXObject("Microsoft.XMLHTTP");
		} 
		catch (e2) 
		{
			req = false;
		}
	}
	if (!req && typeof XMLHttpRequest != 'undefined') 
	{
		req = new XMLHttpRequest();
	}
	req.open("GET",url,true);
	req.onreadystatechange = processDynamic;
	req.send(null);		    
}
// Maneja el evento onreadystatechange del objeto req
function processStatic() {
    // Solo si el documento ya está cargado
	// Otros estados son:
	// 0 = uninitialized <-> 1 = loading <-> 2 = loaded <-> 3 = interactive <-> 4 = complete	    
    if (req.readyState == 4) 
    {
        // Sólo si hay respuesta positiva "OK", esto es enviado por el servidor        
        if (req.status == 200) 
        {                        
            
            //CleanDiv();
            //PaintDiv();
        } 
    }
}
// Maneja el evento onreadystatechange del objeto req
function processDynamic()
 {
    // Solo si el documento ya está cargado
	// Otros estados son:
	// 0 = uninitialized <-> 1 = loading <-> 2 = loaded <-> 3 = interactive <-> 4 = complete		
	if (req.readyState == 4) 
    {  
         //alert(req.status);
        // Sólo si hay respuesta positiva "OK", esto es enviado por el servidor        
        if (req.status == 200) 
        {          
			//alert("d4");
            CleanDiv();
            //alert("d5");
            PaintDiv();
            //alert("d6");
        } 
    }
}
function LoadPageStatic(url,controlRateId,controlPictureId,controlVote,controlAvRating,controlTotalVote) 
{	rate="";
    rate = document.getElementById('controlRateId').value;
    alert(rate);
    pictureId = document.getElementById('controlPictureId').value;    
                        	
	voteNumber = parseInt(document.getElementById('controlVote').innerHTML);
	voteNumber = voteNumber + 1;	
	document.getElementById('controlVote').innerHTML = voteNumber;
	
	totalVotes = parseInt(document.getElementById('controlTotalVote').value) + parseInt(rate);	
	document.getElementById('controlTotalVote').value = totalVotes;
	
	document.getElementById('controlAvRating').innerHTML = ((totalVotes + parseInt(rate)) / (voteNumber + 1)).toFixed(2);
	
	ajax_do(url+'&rateImage='+rate+'&pictureId='+pictureId);		
}
/*
function LoadPageStatic(url) 
{           
    rate = document.getElementById('ddlRateStatic').value;
    pictureId = document.getElementById('PictureIdStatic').value;    
                        
	LoadPageStaticXML(url+'&rateImage='+rate+'&pictureId='+pictureId);	
}
*/
// Carga los productos de acuerdo a la categoría seleccionada
function LoadPageDynamic(url,controlDivId) 
{                              
    //rate = document.getElementById('ddlRateDynamic').value;            
    //pictureId = document.getElementById('PictureIdDynamic').value; 
    
    rate = ""; 
    pictureId = "";
    piercing= "";
    both = "";
    pictureTypeId = "";
    pictureTypeName = "";
    /*tattoo = document.getElementById('Tattoo');    
    if(tattoo.checked)
    {
		pictureTypeId = tattoo.value;
		pictureTypeName = "Tattoo";
	}
	piercing = document.getElementById('Piercing');	
	if(piercing.checked)
	{
		pictureTypeId = piercing.value;		
		pictureTypeName = "Piercing";
	}
	both = document.getElementById('Both');
	if(both.checked)
		pictureTypeId = both.value;
    */
    IsMature = "";
    categoryId = "";
    /*
    if(pictureTypeName == "Tattoo")
    {
		ExceptMatureTattoo = document.getElementById('ExceptMatureTattoo');    
		if(ExceptMatureTattoo.checked)
			IsMature = ExceptMatureTattoo.value;
		IncludeMatureTattoo = document.getElementById('IncludeMatureTattoo');    
		if(IncludeMatureTattoo.checked)
			IsMature = IncludeMatureTattoo.value;
		ExceptMaturePictureTattoo = document.getElementById('ExceptMaturePictureTattoo');    
		if(ExceptMaturePictureTattoo.checked)
			IsMature = ExceptMaturePictureTattoo.value;
		IncludeMaturePictureTattoo = document.getElementById('IncludeMaturePictureTattoo');    
		if(IncludeMaturePictureTattoo.checked)
			IsMature = IncludeMaturePictureTattoo.value;
			
		categoryId = document.getElementById('ddlTattoo').value;  
    }
    else if(pictureTypeName == "Piercing")
    {
		ExceptMaturePiercing = document.getElementById('ExceptMaturePiercing');
		if(ExceptMaturePiercing.checked)
			IsMature = ExceptMaturePiercing.value;
		IncludeMaturePiercing = document.getElementById('IncludeMaturePiercing');    
		if(IncludeMaturePiercing.checked)
			IsMature = IncludeMaturePiercing.value;
		ExceptMaturePicturePiercing = document.getElementById('ExceptMaturePicturePiercing');    
		if(ExceptMaturePicturePiercing.checked)
			IsMature = ExceptMaturePicturePiercing.value;
		IncludeMaturePicturePiercing = document.getElementById('IncludeMaturePicturePiercing');    
		if(IncludeMaturePicturePiercing.checked)
			IsMature = IncludeMaturePicturePiercing.value;
		
		categoryId = document.getElementById('ddlPiercing').value;  		
    }
    */
    ROOT = controlDivId;
    //alert("d1");
	//LoadPageDynamicXML(url+'&rateImage='+rate+'&pictureId='+pictureId+'&PictureTypeId='+pictureTypeId+'&typeName='+IsMature+'&CategoryId='+categoryId+'&hideControls=N');	
	//alert(url+'&rateImage='+rate+'&pictureId='+pictureId+'&PictureTypeId='+pictureTypeId+'&typeName='+IsMature+'&CategoryId='+categoryId+'&DivId='+controlDivId);	
	LoadPageDynamicXML(url+'&rateImage='+rate+'&pictureId='+pictureId+'&PictureTypeId='+pictureTypeId+'&typeName='+IsMature+'&CategoryId='+categoryId+'&DivId='+controlDivId);	
}

function LoadPageDynamicTemp(url,controlRateId,controlName,controlDivId)
{                
    rate = document.getElementById(controlRateId).value;
    control = document.getElementById(controlName).value.split(',');
    
    pictureId = control[0];    
    pictureTypeId = control[1];        
    isMature = control[2];        
    categoryId = control[3];        
        		
	var pathUrl = url+'&rateImage='+rate+'&pictureId='+pictureId+'&PictureTypeId='+pictureTypeId+'&typeName='+isMature+'&CategoryId='+categoryId+'&DivId='+controlDivId+'&ControlName='+controlName;
				
	ROOT = controlDivId;
	if (window.XMLHttpRequest) 
    {		
		ajax_do(pathUrl+'&IsFireFox=Y');
	}
	else
	{
		LoadPageDynamicXML(pathUrl);
	}	
}

/*
function LoadPageDynamicTemp(url) 
{        
    rate = document.getElementById('ddlRateDynamic').value;    
    pictureId = document.getElementById('PictureIdDynamic').value;            
    pictureTypeId = document.getElementById('PictureTypeId').value;    
    isMature = document.getElementById('TypeName').value;	
    categoryId = document.getElementById('CategoryId').value;        
        	
	var url = url+'&rateImage='+rate+'&pictureId='+pictureId+'&PictureTypeId='+pictureTypeId+'&typeName='+isMature+'&CategoryId='+categoryId+'&hideControls=Y';
		
	
	if (window.XMLHttpRequest) 
    {
		ajax_do(url+'&IsFireFox=Y');
	}
	else
	{
		LoadPageDynamicXML(url);
	}	
}*/

function CleanDiv()
{	
	element = document.getElementById(ROOT);	
	element.innerHtml = "";	
}
function PaintDiv()
{	    
    content = req.responseText;    
    if(content != "Empty")
    {    
		document.getElementById(ROOT).innerHTML = content;
	}
	alert("paint : " + content);
}
function HideGenderBrowse(AccountTypeBrowse)
{
if(AccountType =="shop")
{
document.getElementById("AccountTypeBrowse").style.display = "none";
}
}
function ChangeDiv(pictureType)
{    
  if(pictureType == "Both")
  {
    document.getElementById("TattooCombo").style.display = "none";
	document.getElementById("PiercingCombo").style.display = "none";
  
    document.getElementById("TattooDiv").style.display = "none";
    document.getElementById("PiercingDiv").style.display = "none";
  }
  else if(pictureType == "Tattoo")
  {        
    document.getElementById("TattooDiv").style.display = "block";
    document.getElementById("PiercingDiv").style.display = "none";
    document.getElementById("PiercingCombo").style.display = "none";          
	
	ExceptMaturePictureTattoo = document.getElementById("ExceptMaturePictureTattoo");
	IncludeMaturePictureTattoo = document.getElementById("IncludeMaturePictureTattoo");
	
	if(ExceptMaturePictureTattoo.checked || IncludeMaturePictureTattoo.checked)
	{
		document.getElementById("TattooCombo").style.display = "block";  
	}
	else
	{
		document.getElementById("TattooCombo").style.display = "none";  
	}
  }
  else if(pictureType == "Piercing")
  {
    document.getElementById("TattooDiv").style.display = "none";
    document.getElementById("PiercingDiv").style.display = "block";
    document.getElementById("TattooCombo").style.display = "none";  
    
    ExceptMaturePicturePiercing = document.getElementById("ExceptMaturePicturePiercing");
	IncludeMaturePicturePiercing = document.getElementById("IncludeMaturePicturePiercing");
	
	if(ExceptMaturePicturePiercing.checked || IncludeMaturePicturePiercing.checked)
	{
		document.getElementById("PiercingCombo").style.display = "block";  
	}
	else
	{
		document.getElementById("PiercingCombo").style.display = "none";  
	}
  }
}
function ViewCombo(option,divName)
{  
  if(divName == "TattooCombo")
  {
    if(option == "N")
    {
		document.getElementById("TattooCombo").style.display = "none";
    }
    else if(option == "Y")
    {
		document.getElementById("TattooCombo").style.display = "block";
    }    
  }
  else if(divName == "PiercingCombo")
  {
    if(option == "N")
    {
		document.getElementById("PiercingCombo").style.display = "none";
    }
    else if(option == "Y")
    {
		document.getElementById("PiercingCombo").style.display = "block";
    }    
  }
}
/*********************************************************************************************************************************************/
function setZIndex(id, z_index) 
{
	if(document.getElementById(id) == null)
	{
		return;
	}
	else
	{
		document.getElementById(id).style.display= z_index;
	}
}
function CloseWindow(homeLink)
{
	url = homeLink + "/LogOff.aspx"	
	
	if(window.event != null) 
	{						
		var abssize = document.body.offsetWidth-30;
		if (window.event.clientY < 0 && event.clientX >= abssize)  
		{
			ajax_do(url);
		}
	}		
}
function SelectAll()
{ 
	Form1.txtBody.select();
}
function showVoteRateMessage()
{
	alert('vipin');
	return;
}
function showMessage(memberNickName)
{
	alert('You already are friend of ' + memberNickName);
	return;
}
function DeleteWarning()
{
	alert('vipin');
	alert('Are sure you to delete personal photo!');
	return;
}
function VoteRanking_CallBack(response)
{
	//alert("index="+response.value);
	document.getElementById("ProfileSummaryData").innerHTML = response.value;			
}


/*---Ajax for Dropdown Country list-----*/
function MemberStateOnChange() 
{
	var stateList = document.getElementById("ddlMemberState");	
	var selectedState = stateList.options[stateList.selectedIndex].value;
	SearchAdvanced.MemberGetCityList(selectedState,MemberStateOnChange_CallBack);
}
function MemberStateOnChange_CallBack(response)
{	
	var select;
	var repList = response.value;
	//alert(repList);
	var list = repList.split(';');
	var subList = list[0].split(':');
	var flag = false;
	var cityFlag = false, stateFlag = false;
	if(subList[1] == '---Select State---')
	{
		stateFlag = true;
		flag = true;
	}
	else if(subList[1] == '---Select City---')
	{
		cityFlag = true;
		flag = true;
	}	
	if(flag)
	{		
		if(cityFlag)
		{
			var i = 0;
			var elSel = document.getElementById('ddlMemberCity');
			document.getElementById("ddlMemberCity").options.length = 0;
			for(i = 0; i < list.length; i++)
			{
				subList = list[i].split(':');
				
				var doc = document.getElementById("ddlMemberCity").ownerDocument;
				if (!doc)
					doc = document.getElementById("ddlMemberCity").document;
				var opt = doc.createElement('OPTION');
				opt.value = subList[0];
				opt.text = subList[1];
				document.getElementById("ddlMemberCity").options.add(opt);	
				document.getElementById("tdMState").style.display = "block";
				document.getElementById("tdMCity").style.display = "block";
				document.getElementById("tdMCityCombo").style.display = "block";
				document.getElementById("tdMStateCombo").style.display ="block";
			}
		}
		else if(stateFlag)
		{
			var i = 0;		
			document.getElementById("ddlMemberState").options.length = 0;
			for(i = 0; i < list.length; i++)
			{
				subList = list[i].split(':');
				
				var doc = document.getElementById("ddlMemberState").ownerDocument;
				if (!doc)
					doc = document.getElementById("ddlMemberState").document;
				var opt = doc.createElement('OPTION');
				opt.value = subList[0];
				opt.text = subList[1];
				document.getElementById("ddlMemberState").options.add(opt);
				
				document.getElementById("tdMState").style.display = "block";
				document.getElementById("tdMCity").style.display = "none";
				document.getElementById("tdMCityCombo").style.display = "none";
				document.getElementById("tdMStateCombo").style.display ="block";	
			}
		}
	}
}
function ShopStateOnChange() 
{
	var stateList = document.getElementById("ddlStudioState");	
	var selectedState = stateList.options[stateList.selectedIndex].value;
	SearchAdvanced.ShopGetCityList(selectedState,ShopStateOnChange_CallBack);	
}
function ShopStateOnChange_CallBack(response)
{	
	///alert(response.value);
	var select;
	var repList = response.value;
	//alert(repList);
	var list = repList.split(';');
	var subList = list[0].split(':');
	//alert('subList[0]: ' + subList[0] + '  : subList[1]: ' + subList[1]);
	var flag = false;
	var cityFlag = false, stateFlag = false;
	if(subList[1] == '---Select State---')
	{
		//alert('state');
		//select = document.getElementById("ddlArtistState");
		stateFlag = true;
		flag = true;
	}
	else if(subList[1] == '---Select City---')
	{
		//alert('city');
		//select = document.getElementById("ddlArtistCity");
		cityFlag = true;
		flag = true;
	}
	//alert(flag + '  :  ');		
	if(flag)
	{
		/*if(select.length)
		{
			for(int i = 0; i < select.length; i++)
			{
				select.remove(i);
			}
		}*/
		//alert(list.length);
		if(cityFlag)
		{
			var i = 0;
			var elSel = document.getElementById('ddlStudioCity');
			//alert(document.getElementById("ddlArtistCity").options.length);
			/*for(i = 0; i < document.getElementById("ddlArtistCity").options.length; i++)
			{
				elSel.remove(elSel.lenght-1);
			}*/
			document.getElementById("ddlStudioCity").options.length = 0;
			for(i = 0; i < list.length; i++)
			{
				subList = list[i].split(':');					
				/*var elOptNew = document.createElement('option');
				elOptNew.text = subList[1];
				elOptNew.value = subList[0];
				document.getElementById("ddlArtistCity").add(elOptNew);*/
				//document.getElementById("ddlArtistCity").options[i] = new Option(subList[1], subList[0]);
				//document.getElementById("ddlArtistCity").options[document.getElementById("ddlArtistCity").options.length - 1].value = subList[0];
				//alert(document.getElementById("ddlArtistCity").options[document.getElementById("ddlArtistCity").options.length - 1].value);
				//subList = null;
				
				var doc = document.getElementById("ddlStudioCity").ownerDocument;
				if (!doc)
					doc = document.getElementById("ddlStudioCity").document;
				var opt = doc.createElement('OPTION');
				opt.value = subList[0];
				opt.text = subList[1];
				document.getElementById("ddlStudioCity").options.add(opt);
				
				document.getElementById("tdACity").style.display = "block";
				document.getElementById("tdACCombo").style.display = "block";
				document.getElementById("tdSCity").style.display = "block";				
				document.getElementById("tdSCityCombo").style.display ="block";
				
				//document.getElementById("ddlStudioCity").disabled = false;
			
			}
			//alert(document.getElementById("ddlArtistCity").options.length);
		}
		else if(stateFlag)
		{
			var i = 0;			
			/*for(i = 0; i < document.getElementById("ddlStudioState").length; i++)
			{
				document.getElementById("ddlStudioState").remove(i);
			}*/
			document.getElementById("ddlStudioState").options.length = 0;
			for(i = 0; i < list.length; i++)
			{
				subList = list[i].split(':');
				
				var doc = document.getElementById("ddlStudioState").ownerDocument;
				if (!doc)
					doc = document.getElementById("ddlStudioState").document;
				var opt = doc.createElement('OPTION');
				opt.value = subList[0];
				opt.text = subList[1];
				document.getElementById("ddlStudioState").options.add(opt);
				document.getElementById("tdACity").style.display = "none";
				document.getElementById("tdACCombo").style.display = "none";
				document.getElementById("tdSCity").style.display = "block";				
				document.getElementById("tdSCityCombo").style.display ="block";
				
				//document.getElementById("ddlStudioState").disabled = false;
				//document.getElementById("ddlStudioCity").disabled = true;
				
			}
		}
	}	
	
}
function MemberCityOnChange()
{
	var MemberCityList = document.getElementById("ddlMemberCity");
	var selectedMCity = MemberCityList.options[MemberCityList.selectedIndex].value;
	element = document.getElementById("MemberCityId");
	element.value = selectedMCity;
}
function ShopCityOnChange()
{
	var ShopCityList = document.getElementById("ddlStudioCity");
	var selectedCity = ShopCityList.options[ShopCityList.selectedIndex].value;
	element = document.getElementById("StudioCityId");
	element.value = selectedCity;
}

function CityOnChange()
{
	var CityList = document.getElementById("ddlArtistCity");
	var SelectedCity = CityList.options[CityList.selectedIndex].value;
	element = document.getElementById("ArtistCityId");
	element.value = SelectedCity;
	//alert(SelectedCity);
	
}
function StudioOnChange()
{
	var studioList = document.getElementById("ddlArtistStudio");
	var Selectedstudio = studioList.options[studioList.selectedIndex].value;
	element = document.getElementById("ArtistStudioId");
	element.value = Selectedstudio;
	alert(Selectedstudio);
	
}
function CityOnChangeStd()
{
	var CityList = document.getElementById("ddlArtistCity");
	alert(CityList);
	var SelectedCity = CityList.options[CityList.selectedIndex].value;
	alert('cityid'+SelectedCity);
	lightbox.GetStudioList(SelectedCity,CityOnChangeStd_CallBack);
	
}
function CityOnChangeStd_CallBack(response)
{	
	
	var select;
	var repList = response.value;
	alert(repList);
	var list = repList.split(';');
	var subList = list[0].split(':');
	var flag = false;
	var cityFlag = false, stateFlag = false;
	if(subList[1] == '---Select Studio---')
	{
		alert('state');
		flag = true;
	}
	
	
	if(flag)
	{
		
			var i = 0;
			var elSel = document.getElementById('ddlArtistStudio');			
		
			document.getElementById("ddlArtistStudio").options.length = 0;
			for(i = 0; i < list.length-1; i++)
			{
				subList = list[i].split(':');					
				var doc = document.getElementById("ddlArtistStudio").ownerDocument;
				if (!doc)
					doc = document.getElementById("ddlArtistStudio").document;
				var opt = doc.createElement('OPTION');
				opt.value = subList[0];
				opt.text = subList[1];
				document.getElementById("ddlArtistStudio").options.add(opt);				
				document.getElementById("tdAStudio").style.display = "block";
				document.getElementById("tdAStudioCombo").style.display = "block";			
				
			}
			
		}
		else
			{
				document.getElementById("tdAStudio").style.display = "none";
				document.getElementById("tdAStudioCombo").style.display = "none";
			}
		
}
function StateOnChange() 
{
	var stateList = document.getElementById("ddlArtistState");	
	var selectedState = stateList.options[stateList.selectedIndex].value;
	SearchAdvanced.GetCityList(selectedState,StateOnChange_CallBack);			
	//document.getElementById("spanArtistCity").innerHTML = 'Loading...';
}
function StateOnChange_CallBack(response)
{	
	
	var select;
	var repList = response.value;
	//alert(repList);
	var list = repList.split(';');
	var subList = list[0].split(':');
	//alert('subList[0]: ' + subList[0] + '  : subList[1]: ' + subList[1]);
	var flag = false;
	var cityFlag = false, stateFlag = false;
	if(subList[1] == '---Select State---')
	{
		//alert('state');
		//select = document.getElementById("ddlArtistState");
		stateFlag = true;
		flag = true;
	}
	else if(subList[1] == '---Select City---')
	{
		//alert('city');
		//select = document.getElementById("ddlArtistCity");
		cityFlag = true;
		flag = true;
	}
	//alert(flag + '  :  ');		
	if(flag)
	{
		/*if(select.length)
		{
			for(int i = 0; i < select.length; i++)
			{
				select.remove(i);
			}
		}*/
		//alert(list.length);
		if(cityFlag)
		{
			var i = 0;
			var elSel = document.getElementById('ddlArtistCity');			
			//alert(document.getElementById("ddlArtistCity").options.length);
			/*for(i = 0; i < document.getElementById("ddlArtistCity").options.length; i++)
			{
				elSel.remove(elSel.lenght-1);
			}*/
			document.getElementById("ddlArtistCity").options.length = 0;
			for(i = 0; i < list.length; i++)
			{
				subList = list[i].split(':');					
				/*var elOptNew = document.createElement('option');
				elOptNew.text = subList[1];
				elOptNew.value = subList[0];
				document.getElementById("ddlArtistCity").add(elOptNew);*/
				//document.getElementById("ddlArtistCity").options[i] = new Option(subList[1], subList[0]);
				//document.getElementById("ddlArtistCity").options[document.getElementById("ddlArtistCity").options.length - 1].value = subList[0];
				//alert(document.getElementById("ddlArtistCity").options[document.getElementById("ddlArtistCity").options.length - 1].value);
				//subList = null;
				
				var doc = document.getElementById("ddlArtistCity").ownerDocument;
				if (!doc)
					doc = document.getElementById("ddlArtistCity").document;
				var opt = doc.createElement('OPTION');
				opt.value = subList[0];
				opt.text = subList[1];
				document.getElementById("ddlArtistCity").options.add(opt);				
				document.getElementById("tdACity").style.display = "block";
				document.getElementById("tdACCombo").style.display = "block";			
				
			}
			//document.getElementById("spanArtistCity").innerHTML = 'Loaded...';		
			//alert(document.getElementById("ddlArtistCity").options.length);
		}
		else if(stateFlag)
		{
			var i = 0;			
		/*	for(i = 0; i < document.getElementById("ddlArtistState").length; i++)
			{
				document.getElementById("ddlArtistState").remove(i);
			}*/
			document.getElementById("ddlArtistCity").options.length = 0;
			for(i = 0; i < list.length; i++)
			{
				subList = list[i].split(':');
				
				var doc = document.getElementById("ddlArtistState").ownerDocument;
				if (!doc)
					doc = document.getElementById("ddlArtistState").document;
				var opt = doc.createElement('OPTION');
				opt.value = subList[0];
				opt.text = subList[1];
				document.getElementById("ddlArtistState").options.add(opt);				
				document.getElementById("tdACity").style.display = "block";
				document.getElementById("tdACCombo").style.display = "block";	
			}
		}
		//alert(document.getElementById("spanArtistState").innerHTML);
	}	
}



function CountryListOnChange() 
{
	var countryList = document.getElementById("ddlArtistCountry");	
	var selectedCountry = countryList.options[countryList.selectedIndex].value;
	SearchAdvanced.GetStateList(selectedCountry,CountryListOnChange_CallBack);	
}
function CountryListOnChange_CallBack(response)
{	
	
	var select;
	var repList = response.value;
//	alert(repList);
	var list = repList.split(';');
	var subList = list[0].split(':');
	//alert('subList[0]: ' + subList[0] + '  : subList[1]: ' + subList[1]);
	var flag = false;
	var cityFlag = false, stateFlag = false;
	if(subList[1] == '---Select State---')
	{
		//alert('state');
		//select = document.getElementById("ddlArtistState");
		stateFlag = true;
		flag = true;
	}
	else if(subList[1] == '---Select City---')
	{
		//alert('city');
		//select = document.getElementById("ddlArtistCity");
		cityFlag = true;
		flag = true;
	}
	//alert(flag + '  :  ');		
	if(flag)
	{
		/*if(select.length)
		{
			for(int i = 0; i < select.length; i++)
			{
				select.remove(i);
			}
		}*/
		//alert(list.length);
		if(cityFlag)
		{
			var i = 0;
			var elSel = document.getElementById('ddlArtistCity');
			//alert(document.getElementById("ddlArtistCity").options.length);
			/*for(i = 0; i < document.getElementById("ddlArtistCity").options.length; i++)
			{
				elSel.remove(elSel.lenght-1);
			}*/
			document.getElementById("ddlArtistCity").options.length = 0;
			for(i = 0; i < list.length; i++)
			{
				subList = list[i].split(':');					
				/*var elOptNew = document.createElement('option');
				elOptNew.text = subList[1];
				elOptNew.value = subList[0];
				document.getElementById("ddlArtistCity").add(elOptNew);*/
				//document.getElementById("ddlArtistCity").options[i] = new Option(subList[1], subList[0]);
				//document.getElementById("ddlArtistCity").options[document.getElementById("ddlArtistCity").options.length - 1].value = subList[0];
				//alert(document.getElementById("ddlArtistCity").options[document.getElementById("ddlArtistCity").options.length - 1].value);
				//subList = null;
				
				var doc = document.getElementById("ddlArtistCity").ownerDocument;
				if (!doc)
					doc = document.getElementById("ddlArtistCity").document;
				var opt = doc.createElement('OPTION');
				opt.value = subList[0];
				opt.text = subList[1];
				document.getElementById("ddlArtistCity").options.add(opt);
				
				document.getElementById("tdACity").style.display = "none";
				document.getElementById("tdACCombo").style.display = "none";					
				document.getElementById("tdAState").style.display = "none";
				document.getElementById("tdASCombo").style.display = "none";
			}
			//alert(document.getElementById("ddlArtistCity").options.length);
		}
		else if(stateFlag)
		{
			var i = 0;			
		/*	for(i = 0; i < document.getElementById("ddlArtistState").length; i++)
			{
				document.getElementById("ddlArtistState").remove(i);
			}*/
			document.getElementById("ddlArtistState").options.length = 0;
			for(i = 0; i < list.length; i++)
			{
				subList = list[i].split(':');
				
				var doc = document.getElementById("ddlArtistState").ownerDocument;
				if (!doc)
					doc = document.getElementById("ddlArtistState").document;
				var opt = doc.createElement('OPTION');
				opt.value = subList[0];
				opt.text = subList[1];
				document.getElementById("ddlArtistState").options.add(opt);
				
				document.getElementById("tdACity").style.display = "none";
				document.getElementById("tdACCombo").style.display = "none";					
				document.getElementById("tdAState").style.display = "block";
				document.getElementById("tdASCombo").style.display = "block";
				
				//document.getElementById("ddlArtistState").disabled = false;
				//document.getElementById("ddlArtistCity").disabled = true;				
			
			}
		}
	}	
}

function ShopCountryListOnChange() 
{
	var countryList = document.getElementById("ddlStudioCountry");	
	var selectedCountry = countryList.options[countryList.selectedIndex].value;
	SearchAdvanced.GetStateListShop(selectedCountry,ShopCountryListOnChange_CallBack);	
}

function ShopCountryListOnChange_CallBack(response)
{	
	///alert(response.value);
	var select;
	var repList = response.value;
	//alert(repList);
	var list = repList.split(';');
	var subList = list[0].split(':');
	//alert('subList[0]: ' + subList[0] + '  : subList[1]: ' + subList[1]);
	var flag = false;
	var cityFlag = false, stateFlag = false;
	if(subList[1] == '---Select State---')
	{
		//alert('state');
		//select = document.getElementById("ddlArtistState");
		stateFlag = true;
		flag = true;
	}
	else if(subList[1] == '---Select City---')
	{
		//alert('city');
		//select = document.getElementById("ddlArtistCity");
		cityFlag = true;
		flag = true;
	}
	//alert(flag + '  :  ');		
	if(flag)
	{
		/*if(select.length)
		{
			for(int i = 0; i < select.length; i++)
			{
				select.remove(i);
			}
		}*/
		//alert(list.length);
		if(cityFlag)
		{
			var i = 0;
			var elSel = document.getElementById('ddlStudioCity');
			//alert(document.getElementById("ddlArtistCity").options.length);
			/*for(i = 0; i < document.getElementById("ddlArtistCity").options.length; i++)
			{
				elSel.remove(elSel.lenght-1);
			}*/
			document.getElementById("ddlStudioCity").options.length = 0;
			for(i = 0; i < list.length; i++)
			{
				subList = list[i].split(':');								
				
				var doc = document.getElementById("ddlStudioCity").ownerDocument;
				if (!doc)
					doc = document.getElementById("ddlStudioCity").document;
				var opt = doc.createElement('OPTION');
				opt.value = subList[0];
				opt.text = subList[1];
				document.getElementById("ddlStudioCity").options.add(opt);
				
				//document.getElementById("ddlStudioCity").disabled = false;
				//document.getElementById("ddlStudioState").disabled = true;		
				
				document.getElementById("tdSCity").style.display = "none";
				document.getElementById("tdSState").style.display = "none";
				document.getElementById("tdSSCombo").style.display = "none";
				document.getElementById("tdSCityCombo").style.display ="none";
			}
			//alert(document.getElementById("ddlArtistCity").options.length);
		}
		else if(stateFlag)
		{
			var i = 0;			
			/*for(i = 0; i < document.getElementById("ddlStudioState").length; i++)
			{
				document.getElementById("ddlStudioState").remove(i);
			}*/
			document.getElementById("ddlStudioState").options.length = 0;
			for(i = 0; i < list.length; i++)
			{
				subList = list[i].split(':');
				
				var doc = document.getElementById("ddlStudioState").ownerDocument;
				if (!doc)
					doc = document.getElementById("ddlStudioState").document;
				var opt = doc.createElement('OPTION');
				opt.value = subList[0];
				opt.text = subList[1];
				document.getElementById("ddlStudioState").options.add(opt);
				
				document.getElementById("tdSCity").style.display = "none";
				document.getElementById("tdSState").style.display = "block";
				document.getElementById("tdSSCombo").style.display = "block";
				document.getElementById("tdSCityCombo").style.display ="none";			
			}
		}
	}	
	
}

function MemberCountryListOnChange() 
{
	var countryList = document.getElementById("ddlMemberCountry");	
	var selectedCountry = countryList.options[countryList.selectedIndex].value;
	SearchAdvanced.GetStateListMember(selectedCountry,MemberCountryListOnChange_CallBack);	
}

function MemberCountryListOnChange_CallBack(response)
{	
	//alert(response.value);
	var select;
	var repList = response.value;
	//alert(repList);
	var list = repList.split(';');
	var subList = list[0].split(':');
	//alert('subList[0]: ' + subList[0] + '  : subList[1]: ' + subList[1]);
	var flag = false;
	var cityFlag = false, stateFlag = false;
	if(subList[1] == '---Select State---')
	{
		//alert('state');
		//select = document.getElementById("ddlArtistState");
		stateFlag = true;
		flag = true;
	}
	else if(subList[1] == '---Select City---')
	{
		//alert('city');
		//select = document.getElementById("ddlArtistCity");
		cityFlag = true;
		flag = true;
	}
	//alert(flag + '  :  ');		
	if(flag)
	{
		/*if(select.length)
		{
			for(int i = 0; i < select.length; i++)
			{
				select.remove(i);
			}
		}*/
		//alert(list.length);
		if(cityFlag)
		{
			var i = 0;
			var elSel = document.getElementById('ddlMemberCity');
			//alert(document.getElementById("ddlArtistCity").options.length);
			/*for(i = 0; i < document.getElementById("ddlArtistCity").options.length; i++)
			{
				elSel.remove(elSel.lenght-1);
			}*/
			document.getElementById("ddlMemberCity").options.length = 0;
			for(i = 0; i < list.length; i++)
			{
				subList = list[i].split(':');					
				/*var elOptNew = document.createElement('option');
				elOptNew.text = subList[1];
				elOptNew.value = subList[0];
				document.getElementById("ddlArtistCity").add(elOptNew);*/
				//document.getElementById("ddlArtistCity").options[i] = new Option(subList[1], subList[0]);
				//document.getElementById("ddlArtistCity").options[document.getElementById("ddlArtistCity").options.length - 1].value = subList[0];
				//alert(document.getElementById("ddlArtistCity").options[document.getElementById("ddlArtistCity").options.length - 1].value);
				//subList = null;
				
				var doc = document.getElementById("ddlMemberCity").ownerDocument;
				if (!doc)
					doc = document.getElementById("ddlMemberCity").document;
				var opt = doc.createElement('OPTION');
				opt.value = subList[0];
				opt.text = subList[1];
				document.getElementById("ddlMemberCity").options.add(opt);
				
				document.getElementById("tdMState").style.display = "none";
				document.getElementById("tdMCity").style.display = "none";
				document.getElementById("tdMCityCombo").style.display = "none";
				document.getElementById("tdMStateCombo").style.display ="none";				
				
			}
			//alert(document.getElementById("ddlArtistCity").options.length);
		}
		else if(stateFlag)
		{
			var i = 0;			
			/*for(i = 0; i < document.getElementById("ddlStudioState").length; i++)
			{
				document.getElementById("ddlStudioState").remove(i);
			}*/
			document.getElementById("ddlMemberState").options.length = 0;
			for(i = 0; i < list.length; i++)
			{
				subList = list[i].split(':');
				
				var doc = document.getElementById("ddlMemberState").ownerDocument;
				if (!doc)
					doc = document.getElementById("ddlMemberState").document;
				var opt = doc.createElement('OPTION');
				opt.value = subList[0];
				opt.text = subList[1];
				document.getElementById("ddlMemberState").options.add(opt);
				
				document.getElementById("tdMState").style.display = "block";
				document.getElementById("tdMCity").style.display = "none";
				document.getElementById("tdMCityCombo").style.display = "none";
				document.getElementById("tdMStateCombo").style.display ="block";
			}
		}
	}	
	
}


/*-------end -----------*/
function NextTattooImage()
{
	/*element = document.getElementById('ihnextImage');
	element.value = 'Yes';
	document.forms[1].submit();*/
	ViewProfile.GetNextTattooImage(NextTattooImage_CallBack);
}
function NextTattooImage_CallBack(response)
{
	alert(response.value);
	//document.getElementById("ProfileSummaryData").innerHTML = response.value;
}


function GetNextAccount()
{
	var pictureType = document.getElementById("pictureType").value;
	var gender = document.getElementById("gender").value;
	index.GetNextAccount(pictureType,gender,GetNextAccount_CallBack);
}
function GetNextAccount_CallBack(response)
{
	document.getElementById("ProfileSummaryData").innerHTML = response.value;			
}
function CallLogOffMethod(homeLink,pageName)
{
	homeLink = homeLink + "/" + pageName;
	RS.Execute(homeLink,'LogOff');
}
function OpenWindow(homeLink)
{	
	element = Trim(document.getElementById('nick').value);
	txtURL="";
	txtURL = Trim(document.getElementById('txtURL').value);
	
	if(element=="" && txtURL=="")
	{
		alert("nickname/Profile URL can not be empty !");
		return;
	}

	if((element.lastIndexOf("/")>0 || element.lastIndexOf(".")>0) && element!=""   )
	{
		alert("Invaild nickname !");
		return;
	}
	
	if(txtURL.lastIndexOf("/")<=0  && txtURL!="" )
	{	
		
		alert("Invaild Profile URL !");
		return;
	}
			
	optionName = "";
	optionStatic = document.getElementById('OptionStatic');
	
	if(optionStatic.checked)
	{
		optionName = optionStatic.value;
		Url = homeLink+"/Generator.aspx?NickName="+element+ "&ProfileURL=" + txtURL + "&optionName="+optionName;
	}
	
	optionDynamic = document.getElementById('OptionDynamic');
	if(optionDynamic.checked)
	{
		IsMature = "";
		categoryId = "";
		pictureTypeId = "";
		pictureTypeName = "";
		
		optionName = optionDynamic.value;
		tattoo = document.getElementById('Tattoo');    
		if(tattoo.checked)
		{
			pictureTypeId = tattoo.value;
			pictureTypeName = "Tattoo";
		}
		piercing = document.getElementById('Piercing');	
		if(piercing.checked)
		{
			pictureTypeId = piercing.value;		
			pictureTypeName = "Piercing";
		}
		both = document.getElementById('Both');
		if(both.checked)
			pictureTypeId = both.value;
  
		if(pictureTypeName == "Tattoo")
		{
			ExceptMatureTattoo = document.getElementById('ExceptMatureTattoo');    
			if(ExceptMatureTattoo.checked)
				IsMature = ExceptMatureTattoo.value;
			IncludeMatureTattoo = document.getElementById('IncludeMatureTattoo');    
			if(IncludeMatureTattoo.checked)
				IsMature = IncludeMatureTattoo.value;
			ExceptMaturePictureTattoo = document.getElementById('ExceptMaturePictureTattoo');    
			if(ExceptMaturePictureTattoo.checked)
				IsMature = ExceptMaturePictureTattoo.value;
			IncludeMaturePictureTattoo = document.getElementById('IncludeMaturePictureTattoo');    
			if(IncludeMaturePictureTattoo.checked)
				IsMature = IncludeMaturePictureTattoo.value;
				
			categoryId = document.getElementById('ddlTattoo').value;  
		}
		else if(pictureTypeName == "Piercing")
		{
			ExceptMaturePiercing = document.getElementById('ExceptMaturePiercing');
			if(ExceptMaturePiercing.checked)
				IsMature = ExceptMaturePiercing.value;
			IncludeMaturePiercing = document.getElementById('IncludeMaturePiercing');    
			if(IncludeMaturePiercing.checked)
				IsMature = IncludeMaturePiercing.value;
			ExceptMaturePicturePiercing = document.getElementById('ExceptMaturePicturePiercing');    
			if(ExceptMaturePicturePiercing.checked)
				IsMature = ExceptMaturePicturePiercing.value;
			IncludeMaturePicturePiercing = document.getElementById('IncludeMaturePicturePiercing');    
			if(IncludeMaturePicturePiercing.checked)
				IsMature = IncludeMaturePicturePiercing.value;
			
			categoryId = document.getElementById('ddlPiercing').value;  		
		}
    
		Url = homeLink+'/Generator.aspx?NickName='+element+ '&ProfileURL=' + txtURL +'&optionName='+optionName+'&PictureTypeId='+pictureTypeId+'&typeName='+IsMature+'&CategoryId='+categoryId;
	}		
	//window.open(Url,'window','height=220,width=620,toolbar=no,directories=no,status=no,menubar=no,scrollbars=no,resizable=yes,modal=yes');	
	//alert(Url);
	document.getElementById('hdnSubmit').value=Url;
	document.forms[1].submit();
}

function OpenWindowTemp(homeLink)
{
	IsMature = "";
	categoryId = "";
	pictureTypeId = "";
	pictureTypeName = "";
		
	tattoo = document.getElementById('Tattoo');    
	if(tattoo.checked)
	{
		pictureTypeId = tattoo.value;
		pictureTypeName = "Tattoo";
	}
	piercing = document.getElementById('Piercing');	
	if(piercing.checked)
	{
		pictureTypeId = piercing.value;		
		pictureTypeName = "Piercing";
	}
	both = document.getElementById('Both');
	if(both.checked)
		pictureTypeId = both.value;

	
	if(pictureTypeName == "Tattoo")
	{
		ExceptMatureTattoo = document.getElementById('ExceptMatureTattoo');    
		if(ExceptMatureTattoo.checked)
			IsMature = ExceptMatureTattoo.value;
		IncludeMatureTattoo = document.getElementById('IncludeMatureTattoo');    
		if(IncludeMatureTattoo.checked)
			IsMature = IncludeMatureTattoo.value;
		ExceptMaturePictureTattoo = document.getElementById('ExceptMaturePictureTattoo');    
		if(ExceptMaturePictureTattoo.checked)
			IsMature = ExceptMaturePictureTattoo.value;
		IncludeMaturePictureTattoo = document.getElementById('IncludeMaturePictureTattoo');    
		if(IncludeMaturePictureTattoo.checked)
			IsMature = IncludeMaturePictureTattoo.value;
			
		categoryId = document.getElementById('ddlTattoo').value;  
	}
	else if(pictureTypeName == "Piercing")
	{
		ExceptMaturePiercing = document.getElementById('ExceptMaturePiercing');
		if(ExceptMaturePiercing.checked)
			IsMature = ExceptMaturePiercing.value;
		IncludeMaturePiercing = document.getElementById('IncludeMaturePiercing');    
		if(IncludeMaturePiercing.checked)
			IsMature = IncludeMaturePiercing.value;
		ExceptMaturePicturePiercing = document.getElementById('ExceptMaturePicturePiercing');    
		if(ExceptMaturePicturePiercing.checked)
			IsMature = ExceptMaturePicturePiercing.value;
		IncludeMaturePicturePiercing = document.getElementById('IncludeMaturePicturePiercing');    
		if(IncludeMaturePicturePiercing.checked)
			IsMature = IncludeMaturePicturePiercing.value;
		
		categoryId = document.getElementById('ddlPiercing').value;  		
	}

	Url = homeLink+'/Generator.aspx?NickName=&optionName=D&PictureTypeId='+pictureTypeId+'&typeName='+IsMature+'&CategoryId='+categoryId;
		
	window.open(Url,'window','height=220,width=620,toolbar=no,directories=no,status=no,menubar=no,scrollbars=no,resizable=yes,modal=yes');	
}
function openPopup(homeLink)//anil saini modified on 18 april 2008
{
	Url = homeLink+'/Generator.aspx?LinkToThisPage=Y' ;
		
	window.open(Url,'window','height=220,width=620,toolbar=no,directories=no,status=no,menubar=no,scrollbars=no,resizable=yes,modal=yes');	
}
function ShowGuestConventionDetails(IsShow)
{					
	elementLabel=document.getElementById('myWorkInformation_GuestConventionsDetailsLabel');
	elementText=document.getElementById('myWorkInformation_GuestConventionsDetailsText');
	
	if(IsShow == "Y")
	{
		elementLabel.style.display = "block";
		elementText.style.display = "block";
	}
	else
	{
		elementLabel.style.display = "none";
		elementText.style.display = "none";
	}
}
function ValidateDecimalNumber(cadena,e)
{                                  
	tecla = (document.all) ? e.keyCode : e.which;
    if (cadena.length > 0)
	{
		var Point = cadena.indexOf('.');
		if(Point < 0)                                                                            
			if (tecla == 46) return true;
	}           

	if (tecla==8) return true;           
	patron = /\d/;
	te = String.fromCharCode(tecla);                                  
	return patron.test(te);                                                             
}
function validar(e,form)
{
	var keynum	
	if(window.event) // IE
		keynum = e.keyCode
	else if(e.which) // Netscape/Firefox/Opera
		keynum = e.which

	//tecla = (document.all) ? e.keyCode : e.which;
	if (keynum==8)	return true; //return key (used to delete)
	if (keynum == 13) //enter key
	{
		return this.ValidateZipCode(form);
	}
	pattern = /\d/; // just numbers are accepted
	te = String.fromCharCode(keynum);
	return pattern.test(te);
} 
function ChangeAmount(TextBoxId, increase)
{
	textBoxElement = document.getElementById(TextBoxId);
	
	amount = parseInt(textBoxElement.value);
	if (increase == 'Add')
		textBoxElement.value = amount + 1;
	else
		if (amount > 1) textBoxElement.value = amount - 1;
}
function ShowState()
{						
	element=document.getElementById("BState")
	element.style.display = "block";		
}

function HideState()
{				
	element=document.getElementById("BState")
	element.style.display = "none";	
}
function LoseFocus(valueText,valueName)
{	
	element = document.getElementById(valueName)	
	if(element.value == "")
		element.value = valueText;			
}
function Focus(valueText,valueName)
{	
	element = document.getElementById(valueName)	
	if(element.value == valueText)
		element.value = "";
}
/////SHOPPING CART/////////
function DoVisible(elementId)
{

	element = document.getElementById(elementId);
	element.style.display = "block";
	element.focus();
}
function DoVisibleFolder(elementId,elementIdB)
{
	
	element = document.getElementById(elementIdB);
	element.style.display = "block";


	element = document.getElementById(elementId);
	element.style.display = "block";
	element.focus();
}

function ShowRateTattoo()
{
//alert("hi");
	document.getElementById('Rate').style.display = "block";	
	document.getElementById('TattoosExplained').style.display = "none";
	document.getElementById('FreeTattooDesignIdeas').style.display = "none";
	document.getElementById('RTD0').className = 'sel_rateTattoos';
	document.getElementById('RTD1').className = '';
	document.getElementById('RTD2').className = '';	
}
function ShowTattoosExplained()
{
//alert("hi");
	document.getElementById('Rate').style.display = "none";	
	document.getElementById('TattoosExplained').style.display = "block";
	document.getElementById('FreeTattooDesignIdeas').style.display = "none";
	document.getElementById('RTD0').className = '';
	document.getElementById('RTD1').className = 'sel_rateTattoos';
	document.getElementById('RTD2').className = '';
	
}
function ShowFreeTattooDesignIdeas()
{
	document.getElementById('Rate').style.display = "none";	
	document.getElementById('TattoosExplained').style.display = "none";
	document.getElementById('FreeTattooDesignIdeas').style.display = "block";
	document.getElementById('RTD0').className = '';
	document.getElementById('RTD1').className = '';
	document.getElementById('RTD2').className = 'sel_rateTattoos';	
}
/////******TopRankedMembers*****//////
function ShowTopMembers(homeUrl)
{
	document.getElementById('Enthusiants').style.display = "block";	
	document.getElementById('Artist').style.display = "none";
	document.getElementById('Membership').style.display = "none";
	document.getElementById('MembersT').className = 'sel';
	document.getElementById('ArtistsT').className = '';
	document.getElementById('ShopsT').className = '';
	//element = document.getElementById('tabs')
	//element.src = homeUrl + '/images/members_on.gif';
}
function ShowTopArtists(homeUrl)
{
	document.getElementById('Enthusiants').style.display = "none";	
	document.getElementById('Artist').style.display = "block";
	document.getElementById('Membership').style.display = "none";
	document.getElementById('ArtistsT').className = 'sel';
	document.getElementById('MembersT').className = '';
	document.getElementById('ShopsT').className = '';
	//element = document.getElementById('tabs')
	//element.src = homeUrl + '/images/artist_on.gif';
}
function ShowTopShops(homeUrl)
{
	document.getElementById('Enthusiants').style.display = "none";	
	document.getElementById('Artist').style.display = "none";
	document.getElementById('Membership').style.display = "block";
	document.getElementById('ShopsT').className = 'sel';
	document.getElementById('MembersT').className = '';
	document.getElementById('ArtistsT').className = '';
	//element = document.getElementById('tabs')
	//element.src = homeUrl + '/images/shm_on.gif';
}
//////*****BGTControls*******////////
function ShowBlog()
{
	document.getElementById('SummaryBlog').style.display = "block";	
	document.getElementById('SummaryTestimonial').style.display = "none";
	document.getElementById('SummaryGroup').style.display = "none";		
	//ShowBGTControls(5);			
}
function ShowFriend()
{

	document.getElementById('SummaryFriend').style.display = "block";
	document.getElementById('SummaryBlog').style.display = "none";	
	document.getElementById('SummaryTestimonial').style.display = "none";
	document.getElementById('SummaryGroup').style.display = "none";
	document.getElementById('GroupsT').className = '';
	document.getElementById('FriendsT').className = 'sel';
	document.getElementById('TestimonialsT').className = '';
	//ShowBGTControls(6);			
}
function ShowGroup()
{
	document.getElementById('SummaryBlog').style.display = "none";
	document.getElementById('SummaryFriend').style.display = "none";	
	document.getElementById('SummaryTestimonial').style.display = "none";
	document.getElementById('SummaryGroup').style.display = "block";
	document.getElementById('GroupsT').className = 'sel';
	document.getElementById('FriendsT').className = '';
	document.getElementById('TestimonialsT').className = '';
	//ShowBGTControls(6);			
}
function ShowTestimonial()
{
	document.getElementById('SummaryBlog').style.display = "none";
	document.getElementById('SummaryFriend').style.display = "none";	
	document.getElementById('SummaryTestimonial').style.display = "block";	
	document.getElementById('SummaryGroup').style.display = "none";
	document.getElementById('GroupsT').className = '';
	document.getElementById('FriendsT').className = '';
	document.getElementById('TestimonialsT').className = 'sel';
	//ShowBGTControls(7);	
}
////******Favorites*************//////////
function Href(homeLink)
{
	element = document.getElementById("TypeFavorite");	
	if(element.value == "FA")
		window.location.href = homeLink + '/view-all-favorite-artists.html';
	else if(element.value == "FS")
		window.location.href = homeLink + '/view-all-favorite-shops.html';
	else if(element.value == "FG")
		window.location.href = homeLink + '/view-all-favorite-girls.html';
	else if(element.value == "FP")
		window.location.href = homeLink + '/view-all-favorite-profiles.html';	
	/*
	else if(element.value == "FL")
		window.location.href = homeLink + '/viewallflash.html';*/
}
function ShowFavoriteArtist()
{
	document.getElementById('FavoriteArtist').style.display = "block";	
	document.getElementById('FavoriteShops').style.display = "none";
	document.getElementById('FavoriteGirls').style.display = "none";
	document.getElementById('FavoriteFriends').style.display = "none";
	//document.getElementById('FavoriteFlash').style.display = "none";
	document.getElementById('ProfilesT').className = '';
	document.getElementById('ArtistT').className = 'sel';
	document.getElementById('ShopsT').className = '';
	element = document.getElementById("TypeFavorite");
	element.value = "FA";
	//ShowFavorite(1);
}
function ShowFavoriteShops()
{
	document.getElementById('FavoriteArtist').style.display = "none";	
	document.getElementById('FavoriteShops').style.display = "block";
	document.getElementById('FavoriteGirls').style.display = "none";
	document.getElementById('FavoriteFriends').style.display = "none";
	//document.getElementById('FavoriteFlash').style.display = "none";
	document.getElementById('ProfilesT').className = '';
	document.getElementById('ArtistT').className = '';
	document.getElementById('ShopsT').className = 'sel';	
	element = document.getElementById("TypeFavorite");	
	element.value = "FS";
	//ShowFavorite(2);
}
function ShowFavoriteGirls()
{
	document.getElementById('FavoriteArtist').style.display = "none";	
	document.getElementById('FavoriteShops').style.display = "none";
	document.getElementById('FavoriteGirls').style.display = "block";
	document.getElementById('FavoriteFriends').style.display = "none";
	//document.getElementById('FavoriteFlash').style.display = "none";
	document.getElementById('ProfilesT').className = 'sel';
	document.getElementById('ArtistT').className = '';
	document.getElementById('ShopsT').className = '';	
	element = document.getElementById("TypeFavorite");
	element.value = "FG";
	//ShowFavorite(2);
}
function ShowFavoriteProfiles()
{
	element = document.getElementById("TypeFavorite");
	element.value = "FP";
	//ShowFavorite(0);
	document.getElementById('FavoriteArtist').style.display = "none";	
	document.getElementById('FavoriteShops').style.display = "none";
	document.getElementById('FavoriteGirls').style.display = "none";
	document.getElementById('FavoriteFriends').style.display = "block";
	//document.getElementById('FavoriteFlash').style.display = "none";
	document.getElementById('ProfilesT').className = 'sel';
	document.getElementById('ArtistT').className = '';
	document.getElementById('ShopsT').className = '';
	//document.getElementById('FlashT').className = '';
	//document.getElementById('GroupT').className = '';
}
function ShowFavoriteFlash()
{
	FavoriteArtist.style.display = "none";	
	FavoriteShops.style.display = "none";
	FavoriteGirls.style.display = "none";
	FavoriteFriends.style.display = "none";
	FavoriteFlash.style.display = "block";	
	element = document.getElementById("TypeFavorite");
	element.value = "FL";
	ShowFavorite(4);
}
///// Advance Search //////
function setFocus()
			{
				if(document.getElementById('SearchArtist').style.display=="block")
					document.getElementById('btoSearchArtist').focus();
			}
			
function ShowArtist()
{
	document.getElementById('SearchArtist').style.display = "block";	
	document.getElementById('SearchShop').style.display = "none";
	document.getElementById('SearchMember').style.display = "none";
	document.getElementById('SearchFlash').style.display = "none";
	document.getElementById('SearchGroup').style.display = "none";
	document.getElementById('ArtistsT').className = 'sel';
	document.getElementById('ShopT').className = '';
	document.getElementById('MemberT').className = '';
	document.getElementById('GroupT').className = '';
	document.getElementById('btoSearchArtist').focus();
	//ShowFavorite(0);	
}
function ShowShop()
{	
	document.getElementById('SearchArtist').style.display = "none";	
	document.getElementById('SearchShop').style.display = "block";
	document.getElementById('SearchMember').style.display = "none";
	document.getElementById('SearchFlash').style.display = "none";
	document.getElementById('SearchGroup').style.display = "none";
	document.getElementById('ArtistsT').className = '';
	document.getElementById('ShopT').className = 'sel';
	document.getElementById('MemberT').className = '';
	document.getElementById('GroupT').className = '';	
	document.getElementById('btnSearchStudio').focus();	
	//ShowFavorite(1);		
}
function ShowMember()
{	
	document.getElementById('SearchArtist').style.display = "none";	
	document.getElementById('SearchShop').style.display = "none";
	document.getElementById('SearchMember').style.display = "block";
	document.getElementById('SearchFlash').style.display = "none";
	document.getElementById('SearchGroup').style.display = "none";
	document.getElementById('ArtistsT').className = '';
	document.getElementById('ShopT').className = '';
	document.getElementById('MemberT').className = 'sel';
	document.getElementById('GroupT').className = '';
	document.getElementById('btnSearchMember').focus();			
	//ShowFavorite(2);	
}
function ShowFlash()
{
	document.getElementById('SearchArtist').style.display = "none";	
	document.getElementById('SearchShop').style.display = "none";
	document.getElementById('SearchMember').style.display = "none";
	document.getElementById('SearchFlash').style.display = "block";
	document.getElementById('SearchGroup').style.display = "none";	
	document.getElementById('ArtistsT').className = '';
	document.getElementById('ShopT').className = '';
	document.getElementById('MemberT').className = '';
	document.getElementById('FlashT').className = 'sel';
	document.getElementById('GroupT').className = '';	
	//ShowFavorite(3);	
}
function ShowGroups()
{
	document.getElementById('ArtistsT').className = '';
	document.getElementById('ShopT').className = '';
	document.getElementById('MemberT').className = '';
	document.getElementById('GroupT').className = 'sel';
	document.getElementById('SearchArtist').style.display = "none";	
	document.getElementById('SearchShop').style.display = "none";
	document.getElementById('SearchMember').style.display = "none";
	document.getElementById('SearchFlash').style.display = "none";
	document.getElementById('SearchGroup').style.display = "block";
	document.getElementById('brnSearchGroup').focus();	
}

function ingresoSoloLetras()
{
	if( (window.event.keyCode < 65 || window.event.keyCode > 90) && (window.event.keyCode < 97 || window.event.keyCode > 122) && (window.event.keyCode != 32))
	{
		window.event.keyCode = 0;
	}	
}
function ShowBGTControls(index)
{
	for(i=5; i <= 7; i++)
	{
		element = document.getElementById(i);
		if(index == i)
		{
			element.style.color='#fff';			
		}
		else
		{
			element.style.color='ffcc00';
		}			
	}		
}

function ShowFavorite(index)
{
	for(i=0; i <= 4 ; i++)
	{
		j = i + 1;
		element = document.getElementById(i);
		element1 = document.getElementById('t2nh-' + i);
		if(index == i)
		{						
			//element.style.color='#fff';
			element.style.display = "block";
			element1.className = 'sel';
			
		}
		else
		{
			//element.style.color='ffcc00';
			element.style.display = "none";
			element1.className = '';
			
		}			
	}		
}
function ShowDiv(index)
{
	for(i=0; i <= 2 ; i++)
	{
		element = document.getElementById(i)
		element1 = document.getElementById('a'+ i)	
			
		if(index == element.id)
		{						
			element.style.display = "block";
			//element1.style.backgroundColor='snow';
			//element1.style.color='#333333';
			element1.className = 'sel';
			
		}
		else
		{			
			element.style.display = "none";
			//element1.style.backgroundColor='darkgray';
			//element1.style.color='snow';
			element1.className = '';
		}			
	}		
}
function ShowDiv(index)
{
	for(i=0; i <= 1 ; i++)
	{

		element = document.getElementById(i)
		element1 = document.getElementById('a'+ i)	
		if(index == element.id)
		{						
			element.style.display = "block";
			//element1.style.backgroundColor='snow';
			//element1.style.color='#333333';
			element1.className = 'sel';
			
		}
		else
		{			
			element.style.display = "none";
			//element1.style.backgroundColor='darkgray';
			//element1.style.color='snow';
			element1.className = '';
		}			
	}		
}
function ShowDivDown(index)
{
	for(i=2; i <= 3 ; i++)
	{
		element = document.getElementById(i)
		element1 = document.getElementById('aDown'+ i)	
		if(index == element.id)
		{						
			element.style.display = "block";
			//element1.style.backgroundColor='snow';
			//element1.style.color='#333333';
			element1.className = 'sel';
			
		}
		else
		{			
			element.style.display = "none";
			//element1.style.backgroundColor='darkgray';
			//element1.style.color='snow';
			element1.className = '';
		}			
	}		
}
// show hide function for home page tab
function Showdivhome(divId)
        {
             var i;
            for(i=1;i<4;i++)
            {
               if(document.getElementById('rate'+i)!=null)
               document.getElementById('rate'+i).style.display="none";
               document.getElementById('RTD'+i).className="";
             }
            document.getElementById('RTD'+divId).className="sel_rateTattoos";
            document.getElementById('rate'+divId).style.display="block";
        } 
        
        function Showdiv1(divId)
        {
            var i;
            for(i=5;i<8;i++)
            {
                if(document.getElementById('div'+i)!=null)
                    document.getElementById('div'+i).style.display="none";
                 document.getElementById('Id'+i).className="";
                
            }
            document.getElementById('Id'+divId).className="active";
            document.getElementById('div'+divId).style.display="block";
        } 

/*
function zoom(pagina)
		{			
			newWindow = window.open(pagina,"DisplayWindow","noresize=no");
		}*/
function JustDecimalNumber()
{	
	if(window.event.keyCode != 46 && (window.event.keyCode < 48 || window.event.keyCode > 57))
	{
		window.event.keyCode = 0;
	}
}
function JustNumber()
{	
	if(window.event.keyCode < 48 || window.event.keyCode > 57)
	{
		window.event.keyCode = 0;
	}
}
function SelectAllCheckboxes(spanChk)
{    
    // Added as ASPX uses SPAN for checkbox 
    var oItem = spanChk.children;
     var theBox=(spanChk.type=="checkbox")?spanChk:spanChk.children.item[0];
    xState=theBox.checked;    

        elm=theBox.form.elements;
        for(i=0;i<elm.length;i++)
        if(elm[i].type=="checkbox" && elm[i].id!=theBox.id)
            {            
            if(elm[i].checked!=xState)
            elm[i].click();            
            }
 }
function zoom(pagina)
		{			
			newWindow = window.open(pagina,"DisplayWindow","noresize=no,scrollbars=no,menubar=no,height=340,width=740");
		}
function openPopUp(pageName,width,height,scrolloption)
{
	LeftPosition = (screen.width) ? (screen.width-width)/2 : 0;
	TopPosition = (screen.height) ? (screen.height-height)/2 : 0;
	newWindow = window.open(pageName,"DisplayWindow","height="+height+",width="+width+",scrollbars="+scrolloption+",top="+TopPosition+",left="+LeftPosition+",noresize=no,toolbar=no,location=no,directories=no,status=no,menubar=no");
}

function Close()
{			
	window.close();
}


/*************************************************************************/
/***********************VOTE FUNCTIONS************************************/
function vote(rate, homelink, pageName,typeName)
{
	voteElement = document.getElementById('option_rate');	
	voteElement.value = rate;	
	typeNameElement = document.getElementById('typeName');
	typeNameElement.value = typeName;		
	document.getElementById('VotePhoto').submit();	
	//document.form[1].submit();
}
/*function voteR_CallBack(response)
{
	alert("hello"+response.value);
	document.getElementById("ProfileSummary").innerHTML = response.value;
				
}*/

/*************************************************************************/
/*function ValidateAddPhoto(isUpdate, extensions, ValidatePictureTitle, ValidateUploadImage, ValidateImageExtensions)
{
	if(isUpdate == 0)
	{
		FileUpload = Trim(document.getElementById("AddPersonalPhoto_FileUpload").value);
		FileUpload = FileUpload.toLowerCase();
		if(FileUpload == "")
		{
			alert(ValidateUploadImage);
			return;
		}		
		idxPunto = FileUpload.lastIndexOf('.', FileUpload.length);
		extension = FileUpload.substring(idxPunto, FileUpload.length);
		idxExtension = extensions.indexOf(extension, 0)
		if(idxExtension == -1)
		{
			alert(ValidateImageExtensions);
			return;
		}
	}
		title = document.getElementById("AddPersonalPhoto_txtTitle");	
	/*if (Trim(title.value) == "" || !title.value.match(/^[a-zA-Z0-9\s]+$/))
	{
		alert(ValidatePictureTitle);
		title.focus();
		title.value = "";
		return;
	}
	element = document.getElementById('hdnOk');
	element.value = 'ok';	
	document.forms[1].submit();
}*/

function PhotoPrivacy(url)
{
	element = document.getElementById('cbPrivacy');
	if(element.checked)
	{
		openPopUp(url,545,285,0)
		element = document.getElementById('hdnCheked');
		element.value = 'ok';
	}
	else
	{
		element = document.getElementById('hdnCheked');
		element.value = 'no';
	}
}


function PrevTattooImage()
{
	element = document.getElementById('ihPrevImage');
	element.value = 'Yes';
	document.forms[1].submit();
}

/*********************************************/
/***************Contact Message **************/
function ValidateContactMessage()
{	
	var name = document.getElementById('nameTxt');
	var email = document.getElementById('emailTxt');
	var phone = document.getElementById('phoneTxt');
	var message = document.getElementById('messageTxt');
	
	// First Name Checker
	if (Trim(name.value) == 0 )
	{
		alert("Please enter your name");
		name.focus();
		return false;
	}
	
	// Email Checker
	if (Trim(email.value) == 0 )
	{
		alert("Please enter your email address");
		email.focus();
		return false;
	}
	// Email Checker
	if (email.value.indexOf("@") < 0)
	{
		alert("Incorrect email address. Please re-enter");
		email.focus();
		return false;
	}
	// Email Checker
	if (email.value.indexOf(".") < 0)
	{
		alert("Incorrect email address. Please re-enter");
		email.focus();
		return false;
	}

	// Email Checker
	if (email.value.indexOf(" ") >= 0)
	{
		alert("Incorrect email address. Please re-enter");
		email.focus();
		return false;
	}
	
	// phone Checker
	if (Trim(phone.value) == 0 )
	{
		alert("Please enter your phone");
		phone.focus();
		return false;
	}
	
	// phone Checker

	//if (phone.value.match(/[^0-9]/))([\w]+\.)
	if (phone.value.match(/[^0-9][\w]+\-]./))
	{
		alert ("Phone must contain only numbers.");
		phone.focus();
		return false;
	}
	
	// message Checker
	if (Trim(message.value) == 0 )
	{
		alert("Please enter your comments/suggestions/questions");
		message.focus();
		return false;
	}
	
	// message Checker
	if (message.value.length > 500)
	{
		alert("The max lenght for your comments/suggestions/questions must be 500 chars");
		message.focus();
		return false;
	}	
	element = document.getElementById('hdnOk');
	element.value = 'ok';
	document.forms[1].submit();
	//everything is ok
	alert('Thanks for your comments/suggestions/questions - RankMyTattoos.com team.');
}
/*********************************************/

function ValidateAddPicture(extensions, ValidateUploadImage, ValidateImageExtensions, ValidateCategory, ValidateDescription)
{			
	FileUpload = Trim(document.getElementById("addDessignToInkPad_FileUpload").value);
	FileUpload = FileUpload.toLowerCase();
	if(FileUpload == "")
	{
		alert(ValidateUploadImage);
		return;
	}
	idxPunto = FileUpload.lastIndexOf('.', FileUpload.length);	
	extension = FileUpload.substring(idxPunto, FileUpload.length);
	idxExtension = extensions.indexOf(extension, 0)
	if(idxExtension == -1)
	{
		alert(ValidateImageExtensions);
		return;
	}
	title = document.getElementById("addDessignToInkPad_txtTitle");
	if (Trim(title.value) == "" || !title.value.match(/^[a-zA-Z0-9\s]+$/))	
	{
		alert('You must enter a valid title for picture');
		title.focus();
		title.value = "";
		return;
	}
	strTattooCategory = document.getElementById("ddlCategory").value;		
	if (strTattooCategory == 0)	
	{
		alert('Please Select an Tattoo Category Option');
		document.getElementById("ddlCategory").focus();
		return;
	}	
	vardescription = document.getElementById("addDessignToInkPad_txtDescription");		
	if (Trim(vardescription.value) == "")	
	{
		alert(ValidateDescription);
		vardescription.focus();
		vardescription.value = "";
		return;
	}
	element = document.getElementById('hdnOkDesign');
	element.value = 'ok';
	document.forms[2].submit();
}
function ValidateEditInkPad(ValidatePictureTitle,ValidateDescription)
{				
	title = document.getElementById("EditInkPad_txtTitle");
	if (Trim(title.value) == "" || !title.value.match(/^[a-zA-Z0-9\s]+$/))	
	{
		alert(ValidatePictureTitle);
		title.focus();
		title.value = "";
		return;
	}
	
	strTattooCategory = document.getElementById("ddlCategory").value;	
	if (strTattooCategory == 0)	
	{
		alert('Please Select an Tattoo Category Option');
		document.getElementById("ddlCategory").focus();
		return;
	}	
	vardescription = document.getElementById("EditInkPad_txtDescription");		
	if (Trim(vardescription.value) == "")	
	{
		alert(ValidateDescription);
		vardescription.focus();
		vardescription.value = "";
		return;
	}
	element = document.getElementById('EditInkPadOK');
	element.value = 'Yes';
	document.forms[2].submit();
}

function ValidatorInvitationModule()
{
  list = document.getElementById("invitationModule_lsFriends");
  txtEmail = document.getElementById("txtEmail");
  if((!list.Length) || Trim(title.value) == "")
  {
	alert("Select Atleast friend or Enter Email");
	return;	
  } 
  
  document.forms[1].submit();
}



function Trim(TRIM_VALUE)
{
	if(TRIM_VALUE.length < 1)
	{
		return"";
	}
	TRIM_VALUE = RTrim(TRIM_VALUE);
	TRIM_VALUE = LTrim(TRIM_VALUE);
	if(TRIM_VALUE=="")
	{
		return "";
	}
	else
	{
		return TRIM_VALUE;
	}
}

function RTrim(VALUE)
{
	var w_space = String.fromCharCode(32);
	var v_length = VALUE.length;
	var strTemp = "";
	if(v_length < 0)
	{
		return"";
	}
	var iTemp = v_length -1;

	while(iTemp > -1)
	{
		if(VALUE.charAt(iTemp) == w_space){
	}
	else
	{
		strTemp = VALUE.substring(0,iTemp +1);
		break;
	}
	iTemp = iTemp-1;
	}
	return strTemp;
}

function LTrim(VALUE)
{
	var w_space = String.fromCharCode(32);
	if(v_length < 1)
	{
		return"";
	}
	var v_length = VALUE.length;
	var strTemp = "";
	var iTemp = 0;
	while(iTemp < v_length)
	{
		if(VALUE.charAt(iTemp) == w_space){}
		else
		{
			strTemp = VALUE.substring(iTemp,v_length);
			break;
		}
	iTemp = iTemp + 1;
	}
	return strTemp;
}

/************BLOGS *******************/
function validateSubject()
{
	element = document.getElementById('postNewBlog_txtSubject');
	if (Trim(element.value) == "")
	{
		alert('Please enter a subject for the blog entry');
		return false;
	}
	return true;
}

/*
function SetCommentRank(rank)
{
	element = document.getElementById('commentRank');	
	element.value =  rank;
}
*/



function SetCommentRank(rank, imagesPath, id)
{	
	element = document.getElementById('crown1');
	element.src = imagesPath + 'crown_alpha.gif';
	element = document.getElementById('crown2');
	element.src = imagesPath + 'crown_alpha.gif';
	element = document.getElementById('crown3');
	element.src = imagesPath + 'crown_alpha.gif';
	element = document.getElementById('crown4');
	element.src = imagesPath + 'crown_alpha.gif';
	element = document.getElementById('crown5');
	element.src = imagesPath + 'crown_alpha.gif';
	
	element = document.getElementById(id);
	element.src = imagesPath + 'crown_orange.gif';	
	
	element = document.getElementById('commentRank');	
	element.value =  rank;
}
/*************************************/

/***************PAGINATION***********/
function NextPage(pageNumber)
{	

	element = document.getElementById('pageNumber');
	element.value = pageNumber;
	document.forms[1].submit();
}
function NextPageMostControls(pageNumber,nameControl)
{		
	element = document.getElementById(nameControl);
	element.value = pageNumber;
	document.forms[0].submit();
}
/************************************/

function ValidateFolder()
{	
	element = document.getElementById('folderName');	
	if (Trim(element.value) == "")
	{
		alert('Please enter a folder name');
		element.focus();
		return false;
	}
	return true;
}

function CreateFolder(e)
{
	var keynum	
	if(window.event) // IE
	{
		keynum = e.keyCode
	}
	else if(e.which) // Netscape/Firefox/Opera
	{
		keynum = e.which
	}
	if (keynum == 13) //enter key
	{
		//validate folder
		element = document.getElementById('folderName');	
		if (Trim(element.value) == "")
		{
			alert('Please enter a folder name');
			element.focus();
			return false;
		}
		//everything is ok
		//document.forms[0].submit();
	}
}

//groups
function validateEditGroup()
{
	//group name	
	element = document.getElementById('EditGroup_txtnamegroup');
	if (Trim(element.value) == "" || !element.value.match(/^[a-zA-Z0-9\s]+$/))
	{
		alert('Please enter a valid name of the group');
		element.focus();
		element.value = "";
		return false;
	}

	//group city
	element = document.getElementById('EditGroup_ddlCity').value;	
	if (element == "")
	{
		alert('Please select a valid city');		
		return false;
	}
	
	//zip code
	element = document.getElementById('EditGroup_txtzip');
	if (Trim(element.value) == "" || !element.value.match(/[0-9]/))
	{
		alert('Please enter a valid zip code (only numbers)');
		element.value = "";
		element.focus();
		return false;
	}
	
	//group shortdescription
	element = document.getElementById('EditGroup_txtshortdescription');	
	if (Trim(element.value) == "")
	{
		alert('Please enter the short description of the group');
		element.focus();
		return false;
	}
	
	//group description
	element = document.getElementById('EditGroup_txtdescription');	
	if (Trim(element.value) == "")
	{
		alert('Please enter the description of the group');
		element.focus();
		return false;
	}
	
	validator = document.getElementById('EditGroupIsOK');
	validator.value = 'Yes';	
	document.forms[1].submit();	
}

function validateCreateGroup()
{
	//group name	
	element = document.getElementById('CreateGroup_txtnamegroup');
	if (Trim(element.value) == "" || !element.value.match(/^[a-zA-Z0-9\s]+$/))	
	{
		alert('Please enter a valid name of the group');		
		element.focus();
		element.value = "";	
		return false;
	}
	element = document.getElementById('CreateGroup_txtKeyword');
	if (Trim(element.value) == "" || !element.value.match(/^[a-zA-Z0-9\s]+$/))	
	{
		alert('Please enter a valid keyword');		
		element.focus();
		element.value = "";
		return false;
	}

	//group city
	element = document.getElementById('CreateGroup_ddlCity').value;	
	if (element == "" || element==0)		
	{
		alert('Please select a valid city');		
		return false;
	}
	
	//zip code
	element = document.getElementById('CreateGroup_txtzip');	
	if (Trim(element.value) == "" || !element.value.match(/[0-9]/))
	{
		alert('Please enter a valid zip code (only numbers)');		
		element.focus();
		element.value = "";
		return false;
	}
	
	//group shortdescription
	element = document.getElementById('CreateGroup_txtshortdescription');	
	if (Trim(element.value) == "")
	{
		alert('Please enter the short description of the group');
		element.focus();
		return false;
	}
	
	//group description
	element = document.getElementById('CreateGroup_txtdescription');	
	if (Trim(element.value) == "")
	{
		alert('Please enter the description of the group');
		element.focus();
		return false;
	}
	
	element = document.getElementById('isOK');
	element.value = 'Yes';	
	document.forms[1].submit();	
}
function validateMemberShip()
{		
	vartype1 = document.getElementById("listAccountType_rblAccountType_0")
	vartype2 = document.getElementById("listAccountType_rblAccountType_1")
	vartype3 = document.getElementById("listAccountType_rblAccountType_2")	
	
	if(!vartype1.checked && !vartype2.checked && !vartype3.checked)
	{
		alert('Please select a membership type');
		return false;
	}

	element = document.getElementById('AccountTypeOK');
	element.value = 'Yes';	
	document.forms[1].submit();			
}
function validateChangePassword(CurrentPassword)
{					
	element = document.getElementById('controlPassword_txtCurrentPassword');
	
	if (CurrentPassword != element.value)
	{
		alert('Current Password do not matched. Please re-enter');		
		return false;
	}	
	
	elementNewPassword = document.getElementById('controlPassword_txtNewPassword');	
	if (Trim(elementNewPassword.value) == "")
	{
		alert('Please enter your new password');		
		return false;
	}
		
	elementConfirmNewPassword = document.getElementById('controlPassword_txtConfirmNewPassword');	
	if (elementConfirmNewPassword.value.length == 0)
	{
		alert('Please enter your confirm new password');		
		return false;
	}
	
	if (elementNewPassword.value != elementConfirmNewPassword.value)
	{
		alert('Password do not matched. Please re-enter');		
		return false;
	}
	element = document.getElementById('ControlPasswordOK');
	element.value = 'Yes';	
	document.forms[2].submit();	
}
function ValidateEditImage(ValidatePictureTypes,
						  ValidateMature, ValidateCategory, ValidatePictureTitle, ValidateValidTitle,
						  ValidateDescription)
{
		
	vartype1 = document.getElementById("editGalleryPhoto_rdlPictureTypes_0")
	vartype2 = document.getElementById("editGalleryPhoto_rdlPictureTypes_1")
	if(!vartype1.checked && !vartype2.checked)
	{
		alert(ValidatePictureTypes);
		return;
	}	
	mature1 = document.getElementById("editGalleryPhoto_rdlMature_0");
	mature2 = document.getElementById("editGalleryPhoto_rdlMature_1");
	if(!mature1.checked && !mature2.checked)
	{
		alert(ValidateMature);
		return;
	}	
	title = document.getElementById("editGalleryPhoto_txtTitle");
	if (Trim(title.value) == "" || !title.value.match(/^[a-zA-Z0-9\s]+$/))	
	{
		alert(ValidatePictureTitle);
		title.focus();
		title.value = "";
		return;
	}
	else
	{
		title = title.value.toLowerCase();
		if(title.indexOf('tattoo', 0) > -1 || title.indexOf('piercing', 0) > -1)
		{
			alert(ValidateValidTitle);
			return;
		}
	}
	vardescription = document.getElementById("editGalleryPhoto_txtDescription");
	if(Trim(vardescription.value) == "")
	{
		alert(ValidateDescription);
		vardescription.focus();
		vardescription.value = "";
		return;
	}
	element = document.getElementById('EditImageOK');
	element.value = 'Yes';
	document.forms[2].submit();
}
function ValidateMyWorkInformation()
{		
	element = document.getElementById("myWorkInformation_ddlYear").value;
	
	if(element == "%")
	{
		alert('Please enter a valid date for your Been Tattooing Since:');
		return;
	}
	
	element = document.getElementById('MyWorkInformationOK');
	element.value = 'Yes';	
	document.forms[2].submit();			
}
function ValidatePostBulletin()
{
	element = Trim(document.getElementById("postBulletin_txtsubject").value);
	
	if(element == "")
	{
		alert('Please enter the subject');
		return;
	}
	
	element = Trim(document.getElementById("postBulletin_txtbody").value);
	
	if(element == "")
	{
		alert('Please enter the body');
		return;
	}
	
	element = document.getElementById('PostBulletinOK');
	element.value = 'Yes';	
	document.forms[2].submit();			
}
function ValidatePostBulletinGroup()
{
	element = Trim(document.getElementById("postBulletinGroup_txtsubject").value);
	
	if(element == "")
	{
		alert('Please enter the subject');
		return;
	}
	
	element = Trim(document.getElementById("postBulletinGroup_txtbody").value);
	
	if(element == "")
	{
		alert('Please enter the body');
		return;
	}
	
	element = document.getElementById('PostBulletinGroupOK');
	element.value = 'Yes';	
	document.forms[1].submit();			
}
function ValidateReadBulletin()
{
	element = Trim(document.getElementById("replyBulletin_txtsubject").value);
	
	if(element == "")
	{
		alert('Please enter the subject');
		return;
	}
	
	element = Trim(document.getElementById("replyBulletin_txtmessage").value);
	
	if(element == "")
	{
		alert('Please enter the body');
		return;
	}
	
	element = document.getElementById('ReadBulletinOK');
	element.value = 'Yes';	
	document.forms[1].submit();			
}
function ValidateEditPost()
{
	element = Trim(document.getElementById("EditPost_txtSubject").value);
	if (element == "")	
	{
		alert('Please enter the subject');
		element.focus();
		element.value = "";
		return;
	}	
	element = Trim(document.getElementById("EditPost_txtBody").value);	
	if(element == "")
	{
		alert('Please enter the body');
		element.focus();
		element.value = "";
		return;
	}
	
	element = document.getElementById('EditPostOK');
	element.value = 'Yes';	
	document.forms[2].submit();			
}
function ValidateEditThread()
{	
	element = Trim(document.getElementById("EditThread_txtBody").value);	
	if(element == "")
	{
		alert('Please enter the body');
		return;
	}
	
	element = document.getElementById('EditThreadOK');
	element.value = 'Yes';		
	document.forms[1].submit();				
}
function ValidateEditPostProduct()
{
	element = document.getElementById("ProductDetails_ProductBanner_EditPostControl_txtSubject");
	if (Trim(element.value) == "" || !element.value.match(/^[a-zA-Z0-9\s]+$/))	
	{
		alert('Please enter the subject');
		element.focus();
		element.value = "";
		return;
	}
	
	element = Trim(document.getElementById("ProductDetails_ProductBanner_EditPostControl_txtBody").value);
	if(element == "")
	{
		alert('Please enter the body');
		return;
	}
	
	element = document.getElementById('EditPostProductOK');
	element.value = 'Yes';	
	document.forms[0].submit();			
}
function ValidateEditThreadProduct()
{	
	element = Trim(document.getElementById("ProductDetails_ProductBanner_EditThreadControl_txtBody").value);
	
	if(element == "")
	{
		alert('Please enter the body');
		return;
	}
	
	element = document.getElementById('EditThreadProductOK');
	element.value = 'Yes';	
	document.forms[0].submit();			
}
function ValidateReviewDetails()
{		
	element = Trim(document.getElementById("ReviewDetails_ddlRate").value);
	
	if(element == "")
	{
		alert('Please select a rating');
		return;
	}
	
	element = Trim(document.getElementById("ReviewDetails_txtDescription").value);
	
	if(element == "")
	{
		alert('Please enter a description for review');
		return;
	}
	
	
	element = document.getElementById('ReviewDetailsOK');
	element.value = 'Yes';	
	document.forms[0].submit();			
}
function ValidateAddShoppingCart(extensions, ValidateUploadImage, ValidateImageExtensions, ValidatePictureTypes,
						  ValidateMature, ValidateCategory, ValidatePictureTitle,ValidateDescription, ValidatePictureSize,
						  ValidateWhiteAndBlack,ValidatePrice)
{
	
	FileUpload = document.getElementById("addPhotosForShoppingCar_FileUpload").value;
		
	FileUpload = FileUpload.toLowerCase();
	if(FileUpload == "")
	{
		alert(ValidateUploadImage);
		return;
	}
	idxPunto = FileUpload.lastIndexOf('.', FileUpload.length);
	extension = FileUpload.substring(idxPunto, FileUpload.length);
	idxExtension = extensions.indexOf(extension, 0)
	if(idxExtension == -1)
	{
		alert(ValidateImageExtensions);
		return;
	}
	
	vartype1 = document.getElementById("addPhotosForShoppingCar_rdlPictureTypes_0")
	vartype2 = document.getElementById("addPhotosForShoppingCar_rdlPictureTypes_1")
	if(!vartype1.checked && !vartype2.checked)
	{
		alert(ValidatePictureTypes);
		return;
	}
	
	varSize1 = document.getElementById("addPhotosForShoppingCar_rblPictureSize_0")
	varSize2 = document.getElementById("addPhotosForShoppingCar_rblPictureSize_1")
	varSize3 = document.getElementById("addPhotosForShoppingCar_rblPictureSize_2")
	if(!varSize1.checked && !varSize2.checked && !varSize3.checked)
	{
		alert(ValidatePictureSize);
		return;
	}	
		
	mature1 = document.getElementById("addPhotosForShoppingCar_rdlMature_0");
	mature2 = document.getElementById("addPhotosForShoppingCar_rdlMature_1");
	if(!mature1.checked && !mature2.checked)
	{
		alert(ValidateMature);
		return;
	}
	
	whiteAndBlack1 = document.getElementById("addPhotosForShoppingCar_rblWhiteAndBlack_0");
	whiteAndBlack2 = document.getElementById("addPhotosForShoppingCar_rblWhiteAndBlack_1");
	if(!whiteAndBlack1.checked && !whiteAndBlack2.checked)
	{
		alert(ValidateWhiteAndBlack);
		return;
	}		
	title = document.getElementById("addPhotosForShoppingCar_txtTitle");
	if (Trim(title.value) == "" || !title.value.match(/^[a-zA-Z0-9\s]+$/))	
	{
		alert(ValidatePictureTitle);
		title.focus();
		title.value = "";
		return;
	}
	price = document.getElementById('addPhotosForShoppingCar_txtPrice');		
	if (Trim(price.value) == "" || !price.value.match(/^\d+(?:\.\d{0,2})?$/))
	{
		alert(ValidatePrice);
		price.focus();
		price.value = "";
		return;
	}
	vardescription = document.getElementById("addPhotosForShoppingCar_txtDescription");
	if(Trim(vardescription.value) == "")
	{
		alert(ValidateDescription);
		vardescription.focus();
		vardescription.value = "";
		return;
	}
	element = document.getElementById('ShoppingCartOK');
	element.value = 'ok';	
	document.forms[0].submit();
}
function ValidateAccountSettings()
{
	element = Trim(document.getElementById("accountSettings_txtEmail").value);
	
	if(element == "")
	{
		alert('Please enter your email');
		return;
	}
	
	element = document.getElementById('AccountSettingsOk');
	element.value = 'Yes';	
	document.forms[2].submit();			
}
function ValidateEditPictureComment()
{
	element = Trim(document.getElementById("txtComment").value);
	
	if(element == "")
	{
		element = Trim(document.getElementById("commentLbl").innerHTML);
		if(element == "Testimonial")
		{
			alert('Please Enter Testimonial');
		}
		else
		{
			alert('Please Enter Comment');
		}
		return;
	}
	//alert(element);
	element = document.getElementById('EditPictureCommentOk');
	element.value = 'Yes';
	document.forms[2].submit();			
}
function ValidateEditPictureCommentNew()
{	
	element = Trim(document.getElementById("txtComment").value);
	
	if(element == "")
	{
		element = Trim(document.getElementById("commentLbl").innerHTML);
		if(element == "Testimonial")
		{
			alert('Please Enter Testimonial');
		}
		else
		{
			alert('Please Enter Comment');
		}
		return;
	}	
	element = document.getElementById('EditPictureCommentOk');	
	element.value = 'Yes';	
	document.forms[2].submit();			
}
function EditPictureCommentCancelClick()
{
	
	element = document.getElementById('EditPictureCommentCancel');
	element.value = 'Yes';
	document.forms[1].submit();			
}
function EditPictureCommentCancelClickNew()
{
	
	element = document.getElementById('EditPictureCommentCancel');
	element.value = 'Yes';
	document.forms[0].submit();			
}

function ValidateArtistRecognized()
{
	element = document.getElementById("ArtistRecognized_txtName");
	if (Trim(element.value) == "" || !element.value.match(/^[a-zA-Z\s]+$/))	
	{
		alert('Please enter a valid name');
		element.focus();
		element.value = "";
		return;
	}
	email = document.getElementById("ArtistRecognized_txtEmail");
	if (Trim(email.value) == "" || !email.value.match(/([\w]+@([\w]+\.)+[a-zA-Z]{2,9}(\s*;\s*[\w]+@([\w]+\.)+[a-zA-Z]{2,9})*)$/))
	{
		alert('Please enter a valid email');
		email.focus();
		email.value = "";
		return;
	}
	emailConfirm = document.getElementById("ArtistRecognized_txtConfirmEmail");
	if (Trim(emailConfirm.value) == "" || !emailConfirm.value.match(/([\w]+@([\w]+\.)+[a-zA-Z]{2,9}(\s*;\s*[\w]+@([\w]+\.)+[a-zA-Z]{2,9})*)$/))	
	{
		alert('Please enter a valid confirm email');
		emailConfirm.focus();
		emailConfirm.value = "";
		return;
	}
	
	if(email.value != emailConfirm.value)
	{
		alert('Email do not matched. Please re-enter');
		return;
	}
	
	element = document.getElementById("ArtistRecognized_txtPhone");	
	//if (Trim(element.value) == "" || !element.value.match(/^[a-zA-Z0-9\s][\w]+\-.]+$/))	
	if (Trim(element.value) == "" || element.value.match(/[^0-9][\w]+\-]./))	
	{
		alert('Please enter a valid phone');
		element.focus();
		element.value = "";
		return;
	}
	
	varExperience1 = document.getElementById("ArtistRecognized_rblExperienceLevel_0")
	varExperience2 = document.getElementById("ArtistRecognized_rblExperienceLevel_1")
	varExperience3 = document.getElementById("ArtistRecognized_rblExperienceLevel_2")
	if(!varExperience1.checked && !varExperience2.checked && !varExperience3.checked)
	{
		alert('Please enter your experience level');
		return;
	}
	
	varTatto1 = document.getElementById("ArtistRecognized_rblTattooFlash_0")
	varTatto2 = document.getElementById("ArtistRecognized_rblTattooFlash_1")
	
	if(!varTatto1.checked && !varTatto2.checked)
	{
		alert('Please enter your tattoo flash');
		return;
	}
	
	varLine1 = document.getElementById("ArtistRecognized_rblLineDrawings_0")
	varLine2 = document.getElementById("ArtistRecognized_rblLineDrawings_1")
	
	if(!varLine1.checked && !varLine2.checked)
	{
		alert('Please enter your line drawings');
		return;
	}
	
	//element = Trim(document.getElementById("ArtistRecognized_txtComment").value);
	
	//if(element == "")
	//{
	//	alert('Please enter your comments');
	//	return;
	//}
	
	element = document.getElementById('ArtistRecognizedOk');
	element.value = 'Yes';	
	document.forms[2].submit();			
}
function ValidateBasicInformation()
{
	element = document.getElementById("BasicInformation_txtFirstName");
	
	if (Trim(element.value) == "" || !element.value.match(/^[a-zA-Z\s]+$/))	
	{
		alert('Please enter a valid first name');
		element.focus();
		element.value = "";
		return;
	}
	element = document.getElementById("BasicInformation_txtLastName");
	if (Trim(element.value) == "" || !element.value.match(/^[a-zA-Z\s]+$/))	
	{
		alert('Please enter a valid last name');
		element.focus();
		element.value = "";
		return;
	}
	
	month = document.getElementById("BasicInformation_ddlMonth").value;
	day = document.getElementById("BasicInformation_ddlDay").value;
	year = document.getElementById("BasicInformation_ddlYear").value;	
		
	if(month == "" || day == "" || year == "")
	{
		alert('Please enter a valid date for your birthday');
		return;
	}
	
	varGender1 = document.getElementById("BasicInformation_rdbGender_0")
	varGender2 = document.getElementById("BasicInformation_rdbGender_1")	
	
	if(!varGender1.checked && !varGender2.checked)
	{
		alert('Please select your Gender');
		return;
	}
	element = document.getElementById("BasicInformation_ddlCity").value;
	
	if (element == "")
	{
		alert('Please select a valid city');		
		return;
	}
	
	element = document.getElementById("BasicInformation_txtNickName");
	if (Trim(element.value) == "" || !element.value.match(/^[a-zA-Z0-9\s]+$/))
	{
		alert('Please enter a valid nick name');
		element.focus();
		element.value = "";
		return;
	}	
	
		
	element = document.getElementById('BasicInformationOk');
	element.value = 'Yes';	
	document.forms[2].submit();			
}
function ValidateTellaFriend()
{
	element = document.getElementById("InviteModule_txtName");
	if (Trim(element.value) == "" || !element.value.match(/^[a-zA-Z\s]+$/))	
	{
		alert('Please enter a valid name');
		element.focus();
		element.value = "";
		return false;
	}
	element = document.getElementById("InviteModule_txtEmail");
	//if (Trim(element.value) == "" || !element.value.match(/^([\w]+@([\w]+\.)+[a-zA-Z]{2,9}(\s*;\s*[\w]+@([\w]+\.)+[a-zA-Z]{2,9})*)$/))	
	if (Trim(element.value) == "" || !element.value.match(/^[\w-]+(?:\.[\w-]+)*@(?:[\w-]+\.)+[a-zA-Z]{2,7}$/))	
	{
		alert('You must enter a valid From email address');
		element.focus();
		element.value = "";
		return false;
	}
	element = document.getElementById("InviteModule_txtTo");	
	if(Trim(element.value) == "")
	{
		alert('You must enter a TO email address');
		element.focus();
		element.value = "";
		return false;
	}	
	
	element = document.getElementById('TellFriendOk');
	element.value = 'Yes';	
	document.forms[1].submit();			
}
function ValidaterRquestInvitation()
{
	element = document.getElementById("ReportToBug_txtmailAddress");
	if(Trim(element.value) == "")
	{
		alert('Please enter Subject.');
		element.focus();
		element.value = "";
		return false;
	}

/*		element = document.getElementById("txtMessage");
	if(Trim(element.value) == "")
	{
		alert('Please enter message');
		element.focus();
		element.value = "";
		return false;
	}
if (Trim(element.value) == "" || !element.value.match(/^[a-zA-Z\s]+$/))	
	{
		alert('Please enter a valid email address');
		element.focus();
		element.value = "";
		return false;
	}	*/
	element = document.getElementById('logininnerOk');
	element.value = 'Yes';	
	document.forms[1].submit();			
}
function ValidatePromoteProfile11111111111()
{
	element = document.getElementById('name');
	alert(element.value);
	if (Trim(element.value) == "" || !element.value.match(/^[a-zA-Z\s]+$/))
	{
		alert('Please enter a valid name');
		element.focus();
		element.value = "";
		return;
	}
	element = document.getElementById('nickname');
	if (Trim(element.value) == "" || !element.value.match(/^[a-zA-Z0-9\s]+$/))	
	{
		alert('You must enter a valid nick name');
		element.focus();
		element.value = "";
		return;
	}
	element = document.getElementById('email');
	//if (Trim(element.value) == "" || !element.value.match(/^([\w]+@([\w]+\.)+[a-zA-Z]{2,9}(\s*;\s*[\w]+@([\w]+\.)+[a-zA-Z]{2,9})*)$/))		
	if (Trim(element.value) == "" ||!element.value.match(/^[\w-]+(?:\.[\w-]+)*@(?:[\w-]+\.)+[a-zA-Z]{2,7}$/))
	{
		alert('You must enter a valid email');
		element.focus();
		element.value = "";
		return;
	}	
	alert('vipin');
	element = document.getElementById('PromoteProfileOk');
	element.value = 'Yes';	
	document.forms[2].submit();			
}
function ValidateForgotPassword()
{

		/*if(element == "")
		{
				alert('Please enter your an email');
				flag=true;
		}*/
	
		element = document.getElementById('ForgotPasswordOk');
		alert(element.value);
		element.value = 'Yes';
		document.forms[1].submit();		


	/*var flag;
	flag=false;
	if(element == "")
	{
		alert('Please enter your an email');
		flag=true;
	}
	if(!flag)
	{
		element = document.getElementById('ForgotPasswordOk');
		element.value = 'Yes';	
	}
	return !flag;	*/
}

/*********** QUICK SEARCH *********/
function ValidateSearch(form, homeLink)
{	
	alert('vipin');
	searchName = document.getElementById('txtSearch');
	
	if (Trim(searchName.value) == "")	
	{
		alert('Please enter your search criteria');
		searchName.focus();
		return false;
	}
	
	optionName = "";	
	/*radioWeb = document.getElementById('RadioWeb');	
	if(radioWeb.checked)
	{
		optionName = "W"
	}
	radioTattoo = document.getElementById('RadioTattoo');
	if(radioTattoo.checked)
	{
		optionName = "T"
	}	*/	
	form.action = homeLink + '/Search.aspx?SearchName=' + searchName.value + '&OptionSearch=' + optionName;
	document.forms[1].submit();
	//form.submit();
}
/*********** LOGIN *********/
function ClickEnter()
{	
	if(event.which || event.keyCode)
	{
		if ((event.which == 13) || (event.keyCode == 13))
		{			
			ValidateLogin();
			return false;
		}
	}
	else 
	{		
		return true;
	} 
	
	//document.forms[1].submit();
}

function SignUp(homeLink)
{
	window.location.href = homeLink + '/membership-types.html';
}
function labelClick(cbObject) {
cbObject.checked = !cbObject.checked
}
function ValidateLogin(form)
{

	element = document.getElementById('txtEmail');
	if (Trim(element.value) == "")	
	{
		
		alert('Please enter your email');
		element.focus();
		return false;
	}
	if(!element.value.match(/^[\w-]+(?:\.[\w-]+)*@(?:[\w-]+\.)+[a-zA-Z]{2,7}$/))
	{
		alert('Please enter valid email');
		element.focus();
		return false;
	}
	element = document.getElementById('txtPassword');
	if (Trim(element.value) == "")	
	{
		alert('Please enter your password');
		element.focus();
		return false;
	}
	element = document.getElementById('LoginOk');
	element.value = 'Yes';	
	document.forms[1].submit();	
}
function ValidateLogin1()
{

	var flag;
	flag=false;
	txtEmail = document.getElementById('txtEmail');
	txtPassword = document.getElementById('txtPassword');
	if (Trim(txtEmail.value) == "")	
	{
		
		alert('Please enter your email');
		txtEmail.focus();
		flag=true;
	}
	else if(!txtEmail.value.match(/^[\w-]+(?:\.[\w-]+)*@(?:[\w-]+\.)+[a-zA-Z]{2,7}$/))
	{
		alert('Please enter valid email');
		txtEmail.focus();
		flag=true;
	}
	else if (Trim(txtPassword.value) == "")	
	{
		alert('Please enter your password');
		txtPassword.focus();
		flag=true;
	}
	if(!flag)
	{
		LoginOk = document.getElementById('LoginOk');
		LoginOk.value = 'Yes';
		
	}
	return !flag;
}
function Login(e, form)
{
	var keynum 
	if(window.event) // IE
	{
		keynum = e.keyCode
	}
	else if(e.which) // Netscape/Firefox/Opera
	{
		keynum = e.which
	}	
	if (keynum == 13) //enter key
	{
		return this.ValidateLogin(form);
	}
}
/*
function Search(e,homeLink)
{
	var keynum 
	if(window.event) // IE
	{
		keynum = e.keyCode
	}
	else if(e.which) // Netscape/Firefox/Opera
	{
		keynum = e.which
	}	
	if (keynum == 13) //enter key
	{				
		this.ValidateSearch(homeLink);
	}
}*/
function Search(e,homeLink)
{
	var keynum 
	if(window.event) // IE
	{
		keynum = e.keyCode
	}
	else if(e.which) // Netscape/Firefox/Opera
	{
		keynum = e.which
	} 
	if (keynum == 13) //enter key
	{    
		//this.ValidateSearch(homeLink);
		return true;
	}
}
function ValidateSendEmail()
{
	element = document.getElementById('SendMail_txtName');
	if (Trim(element.value) == "")	
	{
		alert('Please you must enter your name');
		element.focus();
		return;
	}
	element = document.getElementById('SendMail_txtEmail');
	if (Trim(element.value) == "")	
	{
		alert('Please you must enter your email');
		element.focus();
		return;
	}
	element = document.getElementById('SendMail_txtEmailFriends');
	if (Trim(element.value) == "")	
	{
		alert('Please you must enter a emails');
		element.focus();
		return;
	}
	element = document.getElementById('SendEmailOK');
	element.value = 'Yes';
	document.forms[0].submit();
}
function ValidateZipCode(form)
{
	element = document.getElementById('txtZipCode');
	if (Trim(element.value) == "")	
	{
		alert('Please you must enter a zip code');
		element.focus();
		return false;
	}
	element = document.getElementById('ZipCodeOk');
	element.value = 'Yes';
	//form.submit();
	document.forms[0].submit();
}
function ValidatePersonalInformation()
{	
	
	element = document.getElementById("PersonalInformation_txtOccupation");
	//if (Trim(element.value) == "" || !element.value.match(/^[a-zA-Z\s]+$/))
	
	if (!element.value == "" && !element.value.match(/^[a-zA-Z\s]+$/))
	{
		alert('Please enter a valid Occupation');
		element.focus();
		element.value = "";
		return;
	}
	element = document.getElementById('PersonalInformationOk');
	element.value = 'Yes';	
	document.forms[2].submit();			
}
function ValidateMyStoryInformation()
{		
	element = document.getElementById('MyStoryInformationOk');
	element.value = 'Yes';	
	document.forms[2].submit();			
}
function ValidateNetworking()
{		
	element = document.getElementById('NetworkingOk');
	element.value = 'Yes';	
	document.forms[2].submit();			
}
function ValidateManageStudioInformation()
{		
	element = document.getElementById("ManageStudio_txtShopName");
	if (Trim(element.value) == "" || !element.value.match(/^[a-zA-Z0-9\s]+$/))
	{
		alert('Please enter a valid Studio Name');
		element.focus();
		element.value = "";
		return;
	}
	element = document.getElementById("ManageStudio_txtAddress");
	if (Trim(element.value) == "" || !element.value.match(/^[a-zA-Z0-9\s]+$/))
	{
		alert('Please enter a valid Address');
		element.focus();
		element.value = "";
		return;
	}
	element = document.getElementById("ManageStudio_txtZipCode");
	if (Trim(element.value) == "" || !element.value.match(/^[a-zA-Z0-9\s]+$/))
	{
		alert('Please enter a valid ZipCode');
		element.focus();
		element.value = "";
		return;
	}
	element = document.getElementById("ManageStudio_ddlCity").value;	
	if (element == "")
	{
		alert('Please select a valid city');		
		return;
	}
	element = document.getElementById("ManageStudio_txtPhone");
	if (element.value == "" || element.value.match(/^[a-zA-Z0-9\s][\w]+\-]+$/))
	{
		alert('Please enter a valid Phone');
		element.focus();
		element.value = "";
		return;
	}
	
		
	element = document.getElementById('StudioManageInformationOk');
	element.value = 'Yes';	
	document.forms[2].submit();			
}
function ValidateStudioBasicInformation()
{		
	element = document.getElementById("StudioBasicInformation_txtShopName");
	if (Trim(element.value) == "" || !element.value.match(/^[a-zA-Z0-9\s]+$/))
	{
		alert('Please enter a valid Studio Name');
		element.focus();
		element.value = "";
		return;
	}
	element = document.getElementById("StudioBasicInformation_ddlCity").value;	
	if (element == "")
	{
		alert('Please select a valid city');		
		return;
	}
	element = document.getElementById("StudioBasicInformation_txtPhone");
	if (element.value == "" || element.value.match(/^[a-zA-Z0-9\s][\w]+\-]+$/))
	{
		alert('Please enter a valid Phone');
		element.focus();
		element.value = "";
		return;
	}
	/*
	if(document.getElementById("StudioBasicInformation_ddlEndingHours").value >= document.getElementById("StudioBasicInformation_ddlBeginningHours").value)
	{
	    alert('val1'+document.getElementById("StudioBasicInformation_ddlEndingHours").value);
	    alert('val2'+document.getElementById("StudioBasicInformation_ddlBeginningHours").value);
		alert('Closing hours and opening hours is not same.');
		document.getElementById("StudioBasicInformation_ddlEndingHours").focus();
		document.getElementById("StudioBasicInformation_ddlEndingHours").value = "";
		return;
	}
	*/
		
	element = document.getElementById('StudioBasicInformationOk');
	element.value = 'Yes';	
	document.forms[2].submit();			
}
function ValidateStudioShopInformation()
{		
	element = document.getElementById('StudioShopInformationOk');
	element.value = 'Yes';	
	document.forms[2].submit();			
}
function ValidateStudioShopStoryInformation()
{		
	element = document.getElementById('StudioShopStoryInformationOk');
	element.value = 'Yes';	
	document.forms[2].submit();			
}
function setcookie(name,value,path)
{       
   var today = new Date();
   today.setTime( today.getTime() ); 
   var date = new Date();
   date.setTime(date.getTime()+(1*24*60*60*1000));
   var expires = "; expires="+date.toGMTString();
  var cookie_string = name + "=" + escape ( value ) + ( ( path ) ? ";path=" + path : "" )+expires;
  document.cookie = cookie_string;                 
 }

function ValidateEnabled()
{		
	element = document.getElementById("AutoResponderEmail_txtSubject");
	if (Trim(element.value) == "")
	{
		alert('Please enter a subject');
		element.focus();		
		return;
	}
	element = Trim(document.getElementById("AutoResponderEmail_txtBody").value);	
	if (element == "")
	{
		alert('Please enter a body');
		element.focus();
		return;
	}	
		
	element = document.getElementById('EnabledOk');
	element.value = 'Yes';	
	document.forms[1].submit();			
}
function ValidateDisabled()
{				
	element = document.getElementById('DisabledOk');
	element.value = 'Yes';	
	document.forms[1].submit();			
}
//Added By Ankur Sehgal for RatePhoto Using Ajax
function LoadImageByProfile(currIndex)
{
  
  var curAccId=document.getElementById('HdnAccntId');
  GeneratorDynamicPicture.GetNewImage(currIndex,curAccId.value,__callbackDS);
}
 function __callbackDS(response)
       {         
              var curAccId=document.getElementById('hdnCountGallery');
              if(curAccId.value>1)
              {            
                 var dsPicture = response.value;
                 if(dsPicture==null)
                 { 
                   alert('No More Pictures To Be Ranked.');
                 }
                  else
                  {
                   var mytool_array=dsPicture.split(",");
                   var currIndex=document.getElementById('IncrementedValue');
                   currIndex.value=mytool_array[1];
                   var img=document.getElementById('GeneratorDynamicPicture_imgPhoto');
                   var homeLink=document.getElementById('HdnHomeLink');
                   img.src=homeLink.value+"/f/thumbnails/"+mytool_array[0];
                   var pictId=mytool_array[2];
                   var curPicId=document.getElementById('hdnPictureId');
                   curPicId.value=pictId;
                  }
                }
              else
              { 
                 alert('No other Image To Be Ranked.');
              }
              //getPictureDetails(pictId);
       }
     function GetImage()
	 {	
	 var j=document.getElementById('ddlRate').value;
	 var pictureId=document.getElementById('hdnPictureId').value;   
     var path='/';
     if( getCookie('CookieForTattoRank'))
     {
      var Cookie=getCookie('CookieForTattoRank'); 
      var splitCookie_array=Cookie.split(",");
      var i=splitCookie_array.length;
      var addPicId;
      for(i=0;i<=splitCookie_array.length;i++)
      {
        if(splitCookie_array[i]==pictureId)
        {
         isExist=true;
         break;
        }
        else
        {
        isExist=false;
        }
      }
      
      if(!isExist)
      {
       GeneratorDynamicPicture.VoteRanking(j,pictureId,VoteRanking_CallBackNew);
	   //getPictureDetails(pictureId);	
       var cookievalues=Cookie+','+pictureId;
       document.cookie = 'CookieForTattoRank' + "=" + escape (cookievalues) +((path) ? ";path=" + path : "" );
      }
      else
      {
       alert('Cannot Rate More Than Once');
      }
     }
     else
     {
	   setCookie('CookieForTattoRank',pictureId,'/');
	   GeneratorDynamicPicture.VoteRanking(j,pictureId,VoteRanking_CallBackNew);
	   //getPictureDetails(pictureId);		 
	 }
	}
	function VoteRanking_CallBackNew(response)
	{    
	  //alert('Rated SuccessFully');
	}
	
	function setCookie(name,value,path)
 {
   var today = new Date();
   today.setTime(today.getTime());
   var date =new Date();
   date.setTime(date.getTime()+(1*24*60*60*1000));
   var cookie_string =name + "=" + escape (value) +((path) ? ";path=" + path : "" );
   document.cookie = cookie_string;
 }
function getCookie(NameOfCookie)
{
   if (document.cookie.length >0)
    {
     begin = document.cookie.indexOf(NameOfCookie+"=");
     if (begin != -1)   // Note: != means "is not equal to"<br>
     { 
      begin += NameOfCookie.length+1;
      end = document.cookie.indexOf(";", begin);
      if (end == -1) end = document.cookie.length;
      return unescape(document.cookie.substring(begin, end));  
     } 
   }
 return null;  
}
/*************anil saini 19 june 2008**************/
function CancelRegistration(pageName)
{ 
	var url=document.getElementById('hdnURL');
	var strurl = url.value+pageName;
	if(pageName=="/confirmpage.aspx")
	{
	strurl = strurl+"?mailConfirmMessage=claimToAdmin";
	}
	
	window.opener.location.href=strurl;
	window.close();
}

function viewProfile(url)
{
	window.opener.location.href=url;
	window.close();
}

function checkMailValidation()
{
	var From= document.getElementById('MailToAdmin1_txtFrom');
	if(From.value=="")
	{
		alert("From should not be empty!");
		return false;
	}
	
	var subj= document.getElementById('MailToAdmin1_txtSubject');
	if(subj.value=="")
	{
		alert("Subject should not be empty!");
		return false;
	}
	
	var msg= document.getElementById('MailToAdmin1_txtBody');
	if(msg.value=="")
	{
		alert("Message should not be empty!");
		return false;
	}
}

function SetCookieeForForumTopic(name,value,path)
 {  
   var today = new Date();
   today.setTime(today.getTime());
   var date =new Date();
   date.setTime(date.getTime()+(1*24*60*60*1000));
   var cookie_string = name + "=" + escape (value) +((path) ? ";path=" + path : "" );
   document.cookie = cookie_string;
 }
 
 function GetNextAccountForPictureGallery()
{
	var gender = document.getElementById("gender").value;
	index.GetNextAccount(pictureType,gender,GetNextAccount_CallBack);
} 
