// JavaScript Document
var i = 0;
var j;
function SwitchProductAd()
{
	var hfTitle = document.getElementById('hf_title').value; 
	var hfImage = document.getElementById('hf_image').value; 
	var hfDescription = document.getElementById('hf_description').value; 
	var hfLink = document.getElementById('hf_link').value; 
	
	var titleArray = hfTitle.split("||"); 
	var imageArray = hfImage.split("||"); 
	var descriptionArray = hfDescription.split("||");
	var linkArray = hfLink.split("||");
	
	document.getElementById("product_ads").innerHTML = "";
	document.getElementById("product_ads").innerHTML =  titleArray[i]   + "<a href='" + linkArray[i] + "' target='_blank'>" + imageArray[i]  + "</a>" + descriptionArray[i] + " <a href='" + linkArray[i] + "' target='_blank'>more</a>";
	
	i=i+1;
	if(i >= (titleArray.length))
	{
		i=0;
	}
	
	setTimeout("SwitchProductAd()", 10000);
}

function TextLengthCheck(e, textLength)
{
	var question;
    var question_length;

	question = document.getElementById('ask_your_question').value;	
	question_length = question.length
	document.getElementById('count').innerHTML = textLength - question_length;
	
	if(!e)
      e = window.event;
	  
	if (question_length >= textLength)
    {
		document.getElementById("ask_your_question").value = question.substring(0, textLength-1);
    }
}

function ClearText(element_id)
{
	document.getElementById(element_id).value = "";
	document.getElementById(element_id).className = "field";
}
