var baseurl="http://www.musicads.ro/"; 
/* $Id: nv_common_64.js,v 1.1 2008/07/05 08:11:12 ashish Exp $ */

//This method is Used in Simple Search and Boat Post forms.
var textureName='';
var optChar='';
var optGroup='';
var textureGroup='';
var make_opt='';

function boatTypeChange(v1,v2,curval,cond)
{
	var boatid='';
	var bflag=1;

	//If browser is IE but version is not 6.0 then flag will be false
	if(navigator.appVersion.indexOf("MSIE") != -1 && !(parseFloat(navigator.appVersion.substr(navigator.appVersion.indexOf("MSIE")+5,3)) >= 6.0))
		bflag=0;
	if (navigator.appName=="Netscape" && !(parseFloat(navigator.appVersion) >= 4.8))
		bflag=0;

	if(cond == 'Y' || cond == 'POST')
		var id_make="'" + curval + "'";
	else if(cond == 'ADV')
		var id_make=curval;
	else
		var id_make='';

	if(v1)
	{
		if(v1.length)
		{
			if(v1.selectedIndex > -1)
				var boatid=new String(v1.options[v1.selectedIndex].value);
			else
				var boatid='';
		}
		else
			var boatid=v1;
	}
	textureName='';
	if(boatid != '') 	//Boat Type is selected
	{
		v2.length=1;
		var j=1;
        for(i=0; i < m.length; i++)
        {
            goFlag=0;
            arrMakeInfo=(m[i]).split('#');
            arrMakeTypeInfo=(arrMakeInfo[3]).split(',');

            for(k=0; k < arrMakeTypeInfo.length; k++)
            {
                if(arrMakeTypeInfo[k] == boatid)
                    goFlag=1;
            }
            if(goFlag == 0)
                continue;

            var make_value=arrMakeInfo[0];
            var make_text=arrMakeInfo[1];

			if(cond == 'POST' || cond == 'ADV' || arrMakeInfo[2] > 0) 	//Posting boat && Simple Search
			{
				/** OPTION GROUP PART STARTS HERE */
				/* Changes has been made for displaying makes in alphabetical group. */
				if(make_text.match(/^[A-Za-zÄÖ]{1}/) && (!(navigator.userAgent.match(/Opera/))) && bflag == 1)
				{
					optChar='';
					optChar=make_text.substr(0,1);
					optGroup='T';

					if(textureName != optChar)
					{
						textureName=optChar;
						textureGroup=document.createElement ('optgroup');
						textureGroup.label=textureName;
						v2.appendChild(textureGroup);
					}
				}
				else
					optGroup='F';

				if (optGroup != 'F' && textureName != '')
				{
					make_opt=document.createElement('option');
					make_opt.value=make_value;

					if (navigator.userAgent.match(/IE/))
						make_opt.innerText=make_text;
					else
						make_opt.text=make_text;

					textureGroup.appendChild(make_opt);
				}
				else
				{
					makeOpt=new Option(make_text,make_value);
					eval('v2.options[j]=makeOpt');
				}
				/** OPTION GROUP PART ENDS HERE */

				//Display the selected values.
				if(id_make.search("'"+make_value+"'") != -1)
					v2.options[j].selected=true;

                if(id_make == make_value)
					v2.options[j].selected=true;

				j++;
			}
	    }
	}
	else
	{
		//When Boat Type is not selected (Simple Search)
		v2.length=1;
		var j=1;

        for(i=0; i < m.length; i++)
        {
            arrMakeInfo=(m[i]).split('#');

            if(arrMakeInfo[2] > 0 || cond == 'ADV')
            {
                var make_value=arrMakeInfo[0];
                var make_text=arrMakeInfo[1];

				/** OPTION GROUP PART STARTS HERE */
				if(make_text.match(/^[A-Za-zÄÖ]{1}/) && (!(navigator.userAgent.match(/Opera/))) && bflag == 1)
				{
					optChar='';
					optChar=make_text.substr(0,1);
					optGroup='T';

					if (textureName != optChar)
					{
						textureName=optChar;
						textureGroup=document.createElement ('optgroup');
						textureGroup.label=textureName;
						v2.appendChild(textureGroup);
					}
				}
				else
					optGroup='F';

				if (optGroup != 'F' && textureName != '')
				{
					make_opt=document.createElement('option');
					make_opt.value=make_value;

					if (navigator.userAgent.match(/IE/))
						make_opt.innerText=make_text;
					else
						make_opt.text=make_text;

					textureGroup.appendChild(make_opt);
				}
				else
				{
					makeOpt=new Option(make_text,make_value);
					eval('v2.options[j]=makeOpt');
				}
				/** OPTION GROUP PART ENDS HERE */

				//Display the selected values.
				if(id_make.search("'"+make_value+"'") != -1)
					v2.options[j].selected=true;

                if(id_make == make_value)
					v2.options[j].selected=true;

				j++;
			}
		}
	}
}

//Function to change the subtype corresponding to boat type
function subTypeChange(v1,v2,curval,cond)
{
    //If the selected value is not passed in curval, then check
    //whether any subtype is selected and if yes, store it as curval.
    if(curval == '' && v2.selectedIndex > 0)
        curval=v2.options[v2.selectedIndex].value;

    //'s' -> simple search, 'p'-> boat post/edit, 'ADV'->advamce Search
    if(cond == 's' || cond == 'p' || cond == 'ADV')
        curval="'"+curval+"'";

    //holds the seleted boat type.
    var typeId='';

    if(v1.selectedIndex >= 0)
        typeId=v1.options[v1.selectedIndex].value;

    var opt;
    v2.length=0;
    var j=0;

    if(cond == 's') //For simplate search display the 'Boat subtype' as default option.
    {
        opt=new Option(subtype,'');
        eval("v2.options[j]=opt");
        j++;
    }
    else if(cond == 'p')    //For boat post/edit, display the blank value as default option.
    {
        opt=new Option(capSel+' '+subtype,'');
        eval("v2.options[j]=opt");
        j++;
    }
    else if(cond == 'ADV') //For advance search display the 'Boat subtype' as default option.
    {
        opt=new Option(modelDefVal,'');
        eval("v2.options[j]=opt");
        j++;
    }

    if(typeId != '') //If the boat type is selected(boat post/edit, simple search and advanced search)
    {
        for(var i=0; i < r[typeId].length; i++)
        {
            opt=new Option(s[typeId][i],r[typeId][i]);
            eval("v2.options[j]=opt");

            if(curval.search("'"+r[typeId][i]+"'") != -1)
                v2.options[j].selected=true;

            j++;
        }
    }
    else    //If the boat type is not selectd(simple search and advacned search)
    {
        var idBoatType;
        var strIdSubType=new String('');

        //Loop through all of the boat types.
        for(var k=0; k < v1.length; k++)
        {
            var idBoatType=v1.options[k].value;

            if(idBoatType > 0)
            {
                for(var i=0;i < r[idBoatType].length; i++)
                {
                    //Check whether the subtype has been already added in the listbox as one subtype
                    // can belong to more than one boat type.
                    if(strIdSubType.search("'"+r[idBoatType][i]+"'") == -1)
                    {
                        opt=new Option(s[idBoatType][i],r[idBoatType][i]);
                        eval("v2.options[j]=opt");

                        if(curval.search("'"+r[idBoatType][i]+"'") != -1)
                            v2.options[j].selected=true;

                        strIdSubType=strIdSubType+"'"+r[idBoatType][i]+"',";
                        j++;
                    }
                }
            }
        }
    }
}
/**
	Function for changes the make value as per change the boat sub type
	v1=contain the id_boat_type
	v2=contain the id_sub_type
	v3=contain the id_make
	curval=contain the selected/current value of id_make
	cond=wether call from post/editing(p) OR search(s) page.
*/
function makeChange(v1,v2,v3,curval,cond)
{
	if(v1.options[v1.selectedIndex].value == 14)
	{
        var boatid='';
		var bflag=1;

		//If browser is IE but version is not 6.0 then flag will be false
		if(navigator.appVersion.indexOf("MSIE") != -1 && !(parseFloat(navigator.appVersion.substr(navigator.appVersion.indexOf("MSIE")+5,3)) >= 6.0))
			bflag=0;
		if(navigator.appName=="Netscape" && !(parseFloat(navigator.appVersion) >= 4.8))
			bflag=0;

		if(cond == 'Y' || cond == 'POST')
			var id_make="'" + curval + "'";
		else if(cond == 'ADV')
			var id_make=curval;
		else
			var id_make='';

		if(v1)
		{
			if(v1.length)
			{
				if(v1.selectedIndex > -1)
					var boatid=new String(v1.options[v1.selectedIndex].value);
				else
					var boatid='';
			}
			else
				var boatid=v1;
		}
		textureName='';

		if(boatid != '')
		{
			v3.length=1;
			var j=1;

			if(v2 && v2.selectedIndex >= 0 && v2.options[v2.selectedIndex].value == 9)
			{
                for(i=0; i < m.length; i++)
                {
                    goFlag=0;
                    arrMakeInfo=(m[i]).split('#');
                    arrMakeTypeInfo=(arrMakeInfo[3]).split(',');

                    for(k=0; k < arrMakeTypeInfo.length; k++)
                    {
                        if(arrMakeTypeInfo[k] == boatid)
                            goFlag=1;
                    }
                    if(goFlag == 0)
                        continue;

                    var make_value=arrMakeInfo[0];
                    var make_text=arrMakeInfo[1];

					if(cond == 'POST' || cond == 'ADV' || arrMakeInfo[2] > 0) //Posting boat && Simple Search
					{
						/** OPTION GROUP PART STARTS HERE */
						/* Changes has been made for displaying makes in alphabetical group. */
						if(make_text.match(/^[A-Za-zÄÖ]{1}/) && (!(navigator.userAgent.match(/Opera/))) && bflag == 1)
						{
							optChar='';
							optChar=make_text.substr(0,1);
							optGroup='T';

							if (textureName != optChar)
							{
								textureName=optChar;
								textureGroup=document.createElement ('optgroup');
								textureGroup.label=textureName;
								v3.appendChild(textureGroup);
							}
						}
						else
							optGroup='F';

						if(optGroup != 'F' && textureName != '')
						{
							make_opt=document.createElement('option');
							make_opt.value=make_value;

							if(navigator.userAgent.match(/IE/))
								make_opt.innerText=make_text;
							else
								make_opt.text=make_text;

							textureGroup.appendChild(make_opt);
						}
						else
						{
							makeOpt=new Option(make_text,make_value);
							eval('v3.options[j]=makeOpt');
						}
						/** OPTION GROUP PART ENDS HERE */
                        if(id_make.search("'"+make_value+"'") != -1)
                            v3.options[j].selected=true;

                        if(id_make == make_value)
                            v3.options[j].selected=true;

						j++;
					}
				}
				if(v3.selectedIndex == '' || v3.selectedIndex < 1)
					v3.selectedIndex=0;
			}
			else
			{
                for(i=0; i < m.length; i++)
                {
                    goFlag=0;
                    arrMakeInfo=(m[i]).split('#');
                    arrMakeTypeInfo=(arrMakeInfo[3]).split(',');

                    for(k=0; k < arrMakeTypeInfo.length; k++)
                    {
                        if(arrMakeTypeInfo[k] == boatid)
                            goFlag=1;
                    }
                    if(goFlag == 0)
                        continue;

                    var make_value=arrMakeInfo[0];
                    var make_text=arrMakeInfo[1];

					/** This is only for 'other make'(make_id=1) for boat sub type */
					if(make_value == 1)
					{
						/** OPTION GROUP PART STARTS HERE */
						/* Changes has been made for displaying makes in alphabetical group. */
						if(make_text.match(/^[A-Za-z]{1}/) && (!(navigator.userAgent.match(/Opera/))) && bflag == 1)
						{
							optChar='';
							optChar=make_text.substr(0,1);
							optGroup='T';

							if(textureName != optChar)
							{
								textureName=optChar;
								textureGroup=document.createElement ('optgroup');
								textureGroup.label=textureName;
								v3.appendChild(textureGroup);
							}
						}
						else
							optGroup='F';

						if(optGroup != 'F' && textureName != '')
						{
							make_opt=document.createElement('option');
							make_opt.value=make_value;

							if(navigator.userAgent.match(/IE/))
								make_opt.innerText=make_text;
							else
								make_opt.text=make_text;

							textureGroup.appendChild(make_opt);
						}
						else
						{
							makeOpt=new Option(make_text,make_value);
							eval('v3.options[j]=makeOpt');
						}
						/** OPTION GROUP PART ENDS HERE */
                        if(id_make.search("'"+make_value+"'") != -1)
                            v3.options[j].selected=true;

                        if(id_make == make_value)
                            v3.options[j].selected=true;

                        j++;
					}
				}
                if(v3.selectedIndex == '' || v3.selectedIndex < 1)
                    v3.selectedIndex=0;
			}
		}
	}
}

//Function to change year list box options
function yearChange(v1,v2,curval)
{
	var tot=v1.selectedIndex+1;

	if(tot == 1)
		tot=v1.options.length-1;

	if(curval == '' && v2.selectedIndex > 0)
		curval=v2.options[v2.selectedIndex].value;

	v2.length=1;

	for(i=1,j=1; i < tot; j++,i++)
	{
		temp=new Option(v1.options[i].value,v1.options[i].value);
		eval("v2.options[j]=temp");

		if(curval == v1.options[i].value)
			v2.selectedIndex=j;
	}
}

//Function to change the Length,Power and Price list box options
function listboxChange(v1,v2,curval,sign)
{
	if(v1.selectedIndex < 1)
		var st=1;
	else
		var st=v1.selectedIndex;

	if(curval == '' && v2.selectedIndex > 0)
		curval=v2.options[v2.selectedIndex].value;

	var tot=v1.length;
	v2.length=1;

	for(i=st,j=1; i < tot; j++,i++)
	{
        if (parseInt(v1.options[i].value) >= 1000 && parseInt(v1.options[i].value) < 1000000)
        {
            var len=v1.options[i].value.length;
            var disp=v1.options[i].value;
            var disp1=disp.substr(0,len-3);
            var disp2=disp.substr(len-3,len);
            disp=disp1+' '+disp2;
        }
        else if (parseInt(v1.options[i].value) >= 1000000)
        {
            var len=v1.options[i].value.length;
            var disp=v1.options[i].value;
            var disp1=disp.substr(0,len-6);
            var disp2=disp.substr(len-6,len-4);
            var disp3=disp.substr(len-3,len);
            disp=disp1+' '+disp2+' '+disp3;
        }
        else
            var disp=v1.options[i].value;

		if(sign != '')
			disp=disp+' '+sign;

		temp=new Option(disp,v1.options[i].value);
		eval("v2.options[j]=temp");

		if(curval == v1.options[i].value)
			v2.selectedIndex=j;
	}
}

function RemoveGroups(selectId,v2,make_txt)
{
    var lChars=new Array('A','B','C','D','E','F','G','H','I','J','K','L','M','N','O','P','Q','R','S','T','U','V','W','X','Y','Z','Ä','Ö');

	for(var chr=0; chr < lChars.length; chr++)
		RemoveGroup(lChars[chr],selectId);
}

function RemoveGroup(groupLabel,selectId)
{
	try
	{
		var selectList=document.getElementById(selectId);
		var eachGroup=selectList.firstChild;

		while (groupLabel != eachGroup.label)
			eachGroup=eachGroup.nextSibling;

		selectList.removeChild(eachGroup);
	}
	catch(er){}
}

//Function to open new pop up window with variable width and height
function openImg(img_nm,w,h,nm)
{
	var myfeatures="directories=no,location=no,menubar=no,status=no,titlebar=no,toolbar=no,resizable=yes,scrollbars=yes,width="+w+",height="+h+",left=0,top=0";

	if(nm == '')
		nm='new';

	var newImg=open(img_nm,nm,myfeatures);
	newImg.focus();
}

//Function opens window of desired size by giving proper alert window
function doLogin(msgVar,width,height)
{
	openImg("msgWin.php?opt="+msgVar,width,height,'newuser');
}

// Function to submit favorite page by adding/removing boats
function submitFav(thisV)
{
	frmObj = document.fav;
    var i,flag='N',checked_value,img_id='';

	for(i=1; i < document.fav.length; i++)
	{
		if(document.fav.elements[i].type == 'checkbox')
		{
			if(document.fav.elements[i].checked)
			{
				flag='Y';
				continue;
			}
		}
	}
	if(flag != 'Y')
	{
		alert(msgSelectAtLeastOne);
		return false;
	}

	else
	{
	document.fav.action=''+baseurl+'index.php?task=favorite';
	document.fav.submit();
	}
}

// Function to submit favorite page to compare boats.
function compareBoat()
{
    var cnt=flag=0;

    for(var i=1; i < document.fav.length; i++)
    {
        if(document.fav.elements[i].type == 'checkbox' && document.fav.elements[i].checked)
        {
            cnt++;
            continue;
        }
    }
    if(cnt < 2 || cnt > 3)
    {
        alert(msgSelMinTwoMaxFourBoat);
        return false;
    }
    else
    {
        document.fav.action=''+baseurl+'index.php?task=compara';
        document.fav.submit();
    }
}

//Argument 'label' can be the entity name you want to delete,
//for exa., user,dealer,boat etc. and 'nm' can be the user name,
//dealer name or boat id etc.
function newConfirmDel(ref,label,nm)
{
	if(confirm(msgNewDeleteConfirm+" "+label+", '" + nm + "'?"))
		window.location.replace(ref);
}

//To check login sesion of user in VIF while sumbitting
//question or giving answer, if user is not logged in
//a popup window opens where he can log in
function checkQue(file,from)
{
	if(file.id_user.value == '')
	{
		if(from == 'O')
			openImg('../../popUpLogin.php?M=OnlyForRegisteredUser',350,320,'na_login');
		else
			openImg('popUpLogin.php?M=OnlyForRegisteredUser',350,320,'na_login');

		return false;
	}
	var flag='N';

	for(var q=0; q < file.elements.length; q++)
	{
		if(file.elements[q].type == 'text')
		{
			if(!isblank(file.elements[q].value))
			{
				if(!isLong(file.elements[q].value,' ',40))
				{
					alert(msgTooLongWord);
					file.elements[q].select();
					file.elements[q].focus();
					return false;
				}
				flag='Y';
			}
		}
	}
	if(flag == 'N')
	{
		alert(msgBlankForm);
		return false;
	}
	return true;
}

//Function to return nothing, this is used sometimes
//to display tool tip on plain text by making trick
function returnVoid() {}

function confirmReset(thisForm)
{
	if(confirm(msgConfirmReset))
		return true;

	return false;
}


// function to change town list according the selected domicile.
function partTownChange(ptype,town,curval,page)
{
	if(ptype)
	{
		if(ptype.length)
		{
			if (page == 'SELECTPART')
			{
				if(ptype.selectedIndex > -1 && ptype.selectedIndex > 0)
						idPart=new String(ptype.options[ptype.selectedIndex].value);
				else
						idPart='';
			}
			else
			{
				if(ptype.selectedIndex > -1)
						idPart=new String(ptype.options[ptype.selectedIndex].value);
				else
						idPart='';
			}
		}
		else
			partid=ptype;
	}
	if(page == 'POST')
	{
		town.length=1;
		j=1;
	}
	else if(page == 'ADV')
	{
		town.length=0;
		j=0;
	}
	else if (page == 'listService')
	{
		town.length=0;
		j=0;
	}
	else
	{
		town.length=1;
		j=1;
	}
	if(idPart != '')
	{
		if(tId[idPart])
		{
			for(i=0; i < tId[idPart].length; i++)
			{
				cvalue=new String(tId[idPart][i]);
				ctext=new String(tName[idPart][i]);

				cOpt=new Option(ctext,cvalue);
				eval("town.options[j]=cOpt");

				if(tId[idPart][i] == curval)
						town.selectedIndex=j;
				j++;
			}
		}
	}
	else
	{
		j=1;
		town.length=1;
	}
}

function categoryChange(category,subcategory,curval)
{
	if(category)
	{
		if(category.length)
		{
			if(category.selectedIndex > -1)
			{
				idCat=new String(category.options[category.selectedIndex].value);
			}
			else
				idCat='';
		}
		else
			idCat=category;
	}

	subcategory.length=0;
	j=0;

	if(idCat != '')
	{
		if(sId[idCat])
		{
			for(i=0; i < sId[idCat].length; i++)
			{
				if(sCnt[idCat][i] > 0)
				{
					if(sAvail[idCat][i].match(/NV/))
					{
						cvalue=new String(sId[idCat][i]);
						ctext=new String(sName[idCat][i]);

						cOpt=new Option(ctext,cvalue);
						eval("subcategory.options[j]=cOpt");

						if(sId[idCat][i] == curval)
							subcategory.selectedIndex=j;
						j++;
					}
				}
			}
		}
	}
	else
	{
		j=0;
		subcategory.length=0;
	}
}
function checkPage(theForm,pageVal)
{
	if(theForm.gotopage.value.match(/^[0-9]{1,3}$/))
	{
		if(theForm.gotopage.value != 0)
		{
			if(theForm.gotopage.value > pageVal)
			{
				alert(msgPageNotAvailable);
				return false;
			}
			else
				return true;
		}
		else
		{
			alert(notValidPageNumber);
			return false;
		}
	}
	else
	{
		alert(notPageVal);
		return false;
	}
}

//	Functions for changing background color of updated row(s) when posting question or answers for Boats.

function whiteBG()
{
	$('que_modal').value = '';
	var elements = document.getElementsByTagName("tr");
	for(var i = 0;i < elements.length;i++)
	{
		if(elements[i].id == "TR_BG" && elements[i].className == "bgyellow" )
		{
			elements[i].className = "bgwhite";
		}
	}
	setTimeout("yellowBG();",500);
}
function yellowBG()
{
	var elements = document.getElementsByTagName("tr");
	for(var i = 0;i < elements.length;i++)
	{
		if(elements[i].id == "TR_BG" && elements[i].className == "bgwhite")
		{
			elements[i].className = "bgyellow";
		}
	}
	setTimeout("oddevenBG();",500);
}
//		Function for doing normal background.
function oddevenBG()
{
	var elements = document.getElementsByTagName("tr");
	for(var i = 0;i < elements.length;i++)
	{
		if(elements[i].id == "TR_BG")
		{
			if(i % 2 == 0)
				elements[i].className = "even";
			else
				elements[i].className = "odd";
		}
	}
}

//		Fn. for Login modal
function loginmodal(opt)
{
//	D => 'Simple Dealer' , N => From View Page , P => 'Post Ad'
	$('lightbox').style.left = "40%";
	if(opt == "D")
	{
		pageURL = "../modalLogin.php?mainOnly=1&sd=1";
		$('lightbox').style.left = "65%";
	}
	else if(opt == "N")
		pageURL = "modalLogin.php?mainOnly=1&sd=0";
	else if(opt == "P")
		pageURL = "modalLogin.php?mainOnly=1&postad=1";

	if(opt != "P" && location.href.search('advSearch') == -1)
		document.getElementById("que_modal").blur();

	lightbox.prototype.content = pageURL;
	lightbox.prototype.activate();
	$('lightbox').style.top = "60%";
	$('lightbox').style.width = "295px";
}

function sd_ajaxQue(formObj,var_O)
{
	if(checkQue(formObj,var_O) != false )
	{
		var pars = Form.serialize($(formObj));
		/* replacing € with &euro; */
		pars = pars.replace(/%E2%82%AC/g,'%26euro%3B');

		new Ajax.Updater('submitXQA', 'sd_listQuestionAnswer.php?ajxQueAns=1', {asynchronous:true, parameters:pars,
						onSuccess:function()
						{
							setTimeout("whiteBG();",1000);
						}
					});
		return false;
	}
	else
		return false;
}

//		Check blank form from modal
function modalForm(frmObj)
{
	var flag='N';
	var page_from = frmObj.page_from.value;
	var login_page;

	if(frmObj.postad.value == 1)
		var returnURL = "postAd.php";
	else
		var returnURL = location.href;

	if(page_from.search('simple_dealer') == -1)
		login_page = 'login.php?ajxLogin=1'
	else
		login_page = '../login.php?ajxLogin=1'

	for(i=0; i < frmObj.elements.length;i++)
	{
		if(frmObj.elements[i].type == 'text')
		{
			if(!isblank(frmObj.elements[i].value))
				flag='Y';
		}
	}
	if(frmObj.passwd.value.split(" ").join("").length == 0)
		flag = 'N';

	if(flag == 'N')
	{
		alert(msgMandet);
		return false;
	}

	if(flag == 'Y')
	{
		var pars = Form.serialize($(frmObj));
		new Ajax.Updater('', login_page, {asynchronous:true, parameters:pars,
						onSuccess:function(response)
						{
							if(response.responseText == "success")
								location.href = returnURL;
							else if(response.responseText == "toHomePage")
								location.href = "home.php";
							else
								$('msgLoginError').innerHTML = '<table width="100%" border="0" cellspacing="3" cellpadding="0"><tr><td height="27" class="message">' + response.responseText + '</td></tr></table>';
						}
					});
	}
	return false;
}
/** Function to change the video status. */
function changeVideoStatus(idAd,videoStatus,idReporter)
{
    var reporterSuffix;

    if(confirm(msgChangeStatus))
    {
        if(idReporter == '')
        {
            reporterSuffix='';
            idReporter='';
        }
        else
            reporterSuffix='_'+idReporter;

        new Ajax.Updater('vStatus'+idAd+reporterSuffix,
                            '/extra/admin/changeVideoStatus.php',
                            {
                                method: 'get',
                                parameters:
                                {
                                    id_boat: idAd,
                                    video_status: videoStatus,
                                    id_reporter: idReporter,
                                    ajxifrm: 'A'
                                }
                            }
                        );
    }
    else
        return;
}
/** Function for confirmation when video ad is delete. */
function confirmVideoDelete(ref)
{
    if(confirm(msgDeleteVideoConfirm))
        window.location.replace(ref);
}
/**
Function to play the video at given id of element.
id_element=>id of element where to display the video.
videoUrl=>viewVideo.php file.
*/
function playVideo(id_element,videoUrl)
{
    var pars='ajxifrm=A';

    new Ajax.Updater(id_element,videoUrl,{asynchronous:true,parameters:pars});
}
//		Check send link form
function checkFL()
{
	if(isblank(document.sendlink.name.value))
	{
		alert(msgFullFLname);
		document.sendlink.name.focus();
		return false;
	}
	if(!document.sendlink.name.value.match(/^[a-zA-ZåÅäÄöÖÁÀÉÈÒÓÙÚáàèéòóùúÝìíýÌÍ´_\s-]{1,50}$/))
	{
		alert(msgFullFLname);
		document.sendlink.name.focus();
		document.sendlink.name.select();
		return false;
	}
	if(!emailInvalid(document.sendlink.userEmail.value))
	{
		alert(msgInvalidEmail);
		document.sendlink.userEmail.focus();
		return false;
	}
	if(isblank(document.sendlink.email.value))
	{
		alert(msgInvalidEmail);
		document.sendlink.email.focus();
		return false;
	}
	s = document.sendlink.email.value;
	removeSpace = s.replace(/ /g,"");
	str1=removeSpace.split(",");

	if(str1.length > 10)
	{
		alert(msgMoreThan10Mail);
		document.sendlink.email.focus();
		return false;
	}
	else
	{
		for(var m=0; m<str1.length; m++)
		{
			if(!emailInvalid(str1[m]))
			{
				alert(msgInvalidEmail);
				document.sendlink.email.focus();
				return false;
			}
		}
	}
	return true;
}
