/*
	Module Name:- USER
	File Name  :- model_details.js
	Create Date:- 04-MARCH-2006
	Intially Create By :- 
	Update History:
*/

function display_model_image(str_path)
{
	
	if (document.images && preloadFlag == true) 
	{
		if(str_path=="noimage")
		{
			document.large_image.src = 'images/image_not_available.jpg';
		}
		else
		{
			document.large_image.src = str_path;
		}
	}
}

function confirm_vote()
{
	with(document.frm_vote)
	{
	if(confirm("Are you sure you want to vote for this model?"))
	{
		if(confirm("Confirmation: Click 'Ok' to vote for this model or 'Cancel' to cancel."))
		{
			return true;
		}
	}
	return false;
	}
}


// this will be used for Get My Banner section
function HighlightAll(theField) 
{
	var tempval=eval("document."+theField)
	tempval.focus()
	tempval.select()
	var copytoclip=1
	/* 
	if (copytoclip==1)
	{		
		therange=tempval.createTextRange()
		therange.execCommand("Copy")
		window.status="Contents highlighted and copied to clipboard!"
		setTimeout("window.status=''",2400);
		copytoclip=0;
	}*/
}

function validate_post_comment()
{
	with(document.frm_comment)
	{

		if(isEmpty(txt_alias.value))
		{
				 alert("Please enter Alias.");
				 txt_alias.select();
				 txt_alias.focus();
				 return false;
		}
		
		if(isEmpty(txt_email.value))
		{
				alert("Please enter email address.");
				txt_email.select();
				txt_email.focus();
				return false;
		}
	   
		if(trim(txt_email.value)!="")
		{
			if(!sValidateMailAddress(txt_email.value))
			{
				alert("Please enter valid email address. Format:email@domain.com");
				txt_email.select();
				txt_email.focus();
				return false;
			}
		}
	  
		if(isEmpty(ta_comment.value))
		{
		   alert("Please enter Comment .");
		   ta_comment.select();
		   ta_comment.focus();
		   return false;
		}

		if(ta_comment.value.length > 512)
		{
		   alert("Comment should not contain more than 512 characters.");
		   ta_comment.select();
		   ta_comment.focus();
		   return false; 	
		}


		if(trim(file_comment_image.value) == "")
		{
			//alert("Please select image #2.");
			//file_comment_image.select();
			//file_comment_image.focus();
			//return false;
		}
		else
		{
			if(checkExt(trim(file_comment_image.value))==false)
			{
				file_comment_image.select();
				file_comment_image.focus();
				return false;
			}
		}


	   	//if(trim(txt_code.value)=="")
		//{
		//	alert("Please enter secret code.");
		//	txt_code.select();
		//	txt_code.focus();
		//	return false;
		//}		
	}
	return true;

}

