var show=0;
var hide=0;
function setBrowser() {
	if(show==0 || hide==0) {
		if (navigator.appName=="Microsoft Internet Explorer"){	
			show='inline';
			hide='none';
		}
		else {
			show='table-row';
			hide='none';
		}
	}
}
setBrowser();

	function onEnterUserMiniLogin() {
		 var key = window.event.keyCode; 
		 if(key==13) {
			document.UMLFORM.submit();
	 	}
	}

	function onEnterUserLogin() {
		 var key = window.event.keyCode; 
		 if(key==13) {
			submitUserLogin();
	 	}
	}

function resetPLForm(){
	document.PF.CID.selectedIndex = 0;
	document.PF.MARKID.selectedIndex = 0;
	document.PF.MODELID.options.length = 1;
	document.PF.CITYID.selectedIndex = 0;
	document.PF.CCID.selectedIndex = 0;
	document.PF.COLORID.selectedIndex = 0;
	document.PF.MODYEAR1.selectedIndex = 0;
	document.PF.MODYEAR2.selectedIndex = 0;	
	document.PF.KM1.value = 0;
	document.PF.KM2.value = 0;
	document.PF.PRICE1.value = 0.0;
	document.PF.PRICE2.value = 0.0;
	document.PF.TYPE_FLAG[2].checked = true;
	document.PF.FROM_TYPE[2].checked = true;
	document.PF.WPHOTO.value = 0;
	document.PF.WPHOTOCHECK.checked = false;
	document.PF.DAMAGECHECK.checked = false;	
}
function colorOn(object, color) {
	curcolor=object.style.backgroundColor
	object.style.backgroundColor=color
}
function colorOut(object) {
	object.style.backgroundColor=curcolor;
}
function changeOpac(opacity, id, type,pictureSrc) { 
    var object = document.getElementById(id).style; 
    object.opacity = (opacity / 100); 
    object.MozOpacity = (opacity / 100); 
    object.KhtmlOpacity = (opacity / 100); 
    object.filter = "alpha(opacity=" + opacity + ")"; 
    if(type==0 && opacity==0) {
		document[id].src=pictureSrc;	
	    setTimeout("displayPicture3('" + id + "','" + pictureSrc + "')",650);     	
    }
} 
function ieBlend(pictureSrc) {
   if(document.all){
      document.images.blendimage.style.filter="blendTrans(duration=2)"
      document.images.blendimage.style.filter="blendTrans(duration=crossFadeDuration)"
      document.images.blendimage.filters.blendTrans.Apply()      
   }
   document.images.blendimage.src = pictureSrc
   if (document.all){
      document.images.blendimage.filters.blendTrans.Play()
   }
}
function displayPicture(imgName,pictureSrc){
	if (navigator.appName=="Microsoft Internet Explorer"){
		ieBlend(pictureSrc);
		return;
 	}
    speed0 = Math.round(200/100); 
    timer0 = 0; 
    for(k = 100; k >=0 ; k--) { 
        setTimeout("changeOpac(" + k + ",'blendimage',0,'"+ pictureSrc +"')",(timer0 * speed0)); 
        timer0+=1; 
    }
}
function displayPicture3(imgName, pictureSrc) {
    speed1 = Math.round(200/100); 
    timer1 = 0; 
    for(i = 0; i <= 100; i++) { 
        setTimeout("changeOpac(" + i + ",'blendimage',1,'"+ pictureSrc +"')",(timer1 * speed1)); 
        timer1+=5; 
    }
}
function makevisible(cur,which){
	strength=(which==0)? 1 : 0.9
	if (cur.style.MozOpacity)
	cur.style.MozOpacity=strength
	else if (cur.filters)
	cur.filters.alpha.opacity=strength*100
}
function hidediv() { 
	document.getElementById("hideshow").style.display = 'none';
	document.getElementById("pictures").style.display = '';		
} 
function showdiv() { 
	document.getElementById("hideshow").style.display = '';
	document.getElementById("pictures").style.display = 'none';
}
function uridChange() {
	if(document.PF.URID.selectedIndex==1) {
		document.getElementById("gallerytable").style.display = '';
		document.getElementById("galleryname").style.display = '';
	}
	else {
		document.getElementById("gallerytable").style.display = 'none';
		document.getElementById("galleryname").style.display = 'none';
	}
}
function hide() {
	document.getElementById("err").style.display = 'none';
}
function formSubmit(formName,formAction,formMethod){
	eval(formName+'.action=formAction');
	eval(formName+'.method=formMethod');
	eval(formName+'.submit()'); 
}
function openNewWindow(theUrl,winName,stuff){
	window.open(theUrl,winName,stuff + ',toolbar=no');
}
function printWindow(){
	window.print();
}
function loadCounties(cityid) {
	ajaxpack.getAjaxRequest('/milan/process/location/getCounties.jsp', 'cityid=' + cityid + '', processGetPostForCounties, 'xml');
}
function processGetPostForCounties(){  
	arrayList = null;
	var myajax=ajaxpack.ajaxobj
	var myfiletype=ajaxpack.filetype
	if (myajax.readyState == 4){
		if (myajax.status==200 || window.location.href.indexOf("http")==-1){
			if (myfiletype=="txt") {
				alert(myajax.responseText)
			}
			else{
				var counties = myajax.responseXML.getElementsByTagName("counties")[0];
				if(counties!=null) {
					arrayList = new Array(counties.childNodes.length);
					for(var i=0;i<counties.childNodes.length;i++) {
						var message = myajax.responseXML.getElementsByTagName("county")[i];
						results = message.childNodes[0].nodeValue.split(","); 
						arrayList[i] = new Array(3);
						arrayList[i][0] = results[0];
						arrayList[i][1] = results[1];
					}					
				}
			}
			
			document.PF.COUNTYID.options.length = 1;			
			if(arrayList!=null) {
				for(var i=0;i<arrayList.length;i++) {
		  			option  = new Option("" + arrayList[i][1] + "","" + arrayList[i][0] + "");
		  			document.PF.COUNTYID.options[i+1] = option;
		  			document.PF.COUNTYID.options.length=i+2;
				}
			}
			
		}				
	}
}
function loadModels(context , markid) {
	ajaxpack.getAjaxRequest(context + '/product/process/getModels.jsp', 'markid=' + markid + '', processGetPostForModels, 'xml');
}
function processGetPostForModels(){  
	arrayList = null;
	var myajax=ajaxpack.ajaxobj
	var myfiletype=ajaxpack.filetype
	if (myajax.readyState == 4){

		if (myajax.status==200 || window.location.href.indexOf("http")==-1){
			if (myfiletype=="txt") {
				alert(myajax.responseText)
			}
			else{
				var counties = myajax.responseXML.getElementsByTagName("models")[0];
				if(counties!=null) {
					arrayList = new Array(counties.childNodes.length);
					for(var i=0;i<counties.childNodes.length;i++) {
						var message = myajax.responseXML.getElementsByTagName("model")[i];
						results = message.childNodes[0].nodeValue.split(","); 
						arrayList[i] = new Array(3);
						arrayList[i][0] = results[0];
						arrayList[i][1] = results[1];
					}					
				}
			}			
			document.PF.MODELID.options.length = 1;			
			if(arrayList!=null) {
				for(var i=0;i<arrayList.length;i++) {
					document.PF.MODELID.focus();
		  			option  = new Option("" + arrayList[i][1] + "","" + arrayList[i][0] + "");
		  			document.PF.MODELID.options[i+1] = option;
		  			document.PF.MODELID.options.length=i+2;		  			
				}
			}
			
		}				
	}
}


function loadCategories(context , type) {
	ajaxpack.getAjaxRequest(context + '/product/process/getCategories.jsp', 'type=' + type + '', processGetPostForCategories, 'xml');
}
function processGetPostForCategories(){  
	arrayList = null;
	var myajax=ajaxpack.ajaxobj
	var myfiletype=ajaxpack.filetype
	if (myajax.readyState == 4){

		if (myajax.status==200 || window.location.href.indexOf("http")==-1){
			if (myfiletype=="txt") {
				alert(myajax.responseText)
			}
			else{
				var counties = myajax.responseXML.getElementsByTagName("models")[0];
				if(counties!=null) {
					arrayList = new Array(counties.childNodes.length);
					for(var i=0;i<counties.childNodes.length;i++) {
						var message = myajax.responseXML.getElementsByTagName("model")[i];
						results = message.childNodes[0].nodeValue.split(","); 
						arrayList[i] = new Array(3);
						arrayList[i][0] = results[0];
						arrayList[i][1] = results[1];
					}					
				}
			}			
			if(document.PF.TYPE.value!=0) {
				hideMotorcycle();
			} else {
				showMotorcycle();
			}				
			document.PF.CID.options.length = 1;			
			if(arrayList!=null) {
				for(var i=0;i<arrayList.length;i++) {
					document.PF.CID.focus();
		  			option  = new Option("" + arrayList[i][1] + "","" + arrayList[i][0] + "");
		  			document.PF.CID.options[i+1] = option;
		  			document.PF.CID.options.length=i+2;		  			
				}
			}
			
		}				
	}
}

function hideMotorcycle() {
				if(document.getElementById("markid")!=null) document.getElementById("markid").style.display = hide;
				if(document.getElementById("markqid")!=null) document.getElementById("markqid").style.display = hide;

				if(document.getElementById("ccid")!=null) document.getElementById("ccid").style.display = hide;
				if(document.getElementById("ccqid")!=null) document.getElementById("ccqid").style.display = hide;

				if(document.getElementById("colorid")!=null) document.getElementById("colorid").style.display = hide;
				if(document.getElementById("colorqid")!=null) document.getElementById("colorqid").style.display = hide;

				document.getElementById("modelid").style.display = hide;

				document.getElementById("kmid").style.display = hide;
				document.getElementById("modyearid").style.display = hide;

				if(document.getElementById("hlid")!=null) document.getElementById("hlid").style.display = hide;

				if(document.getElementById("promodelid")!=null) document.getElementById("promodelid").style.display = show;				
}

function showMotorcycle() {
				if(document.getElementById("markid")!=null) document.getElementById("markid").style.display = show;
				if(document.getElementById("markqid")!=null) document.getElementById("markqid").style.display = show;

				if(document.getElementById("ccid")!=null) document.getElementById("ccid").style.display = show;
				if(document.getElementById("ccqid")!=null) document.getElementById("ccqid").style.display = show;

				if(document.getElementById("colorid")!=null) document.getElementById("colorid").style.display = show;
				if(document.getElementById("colorqid")!=null) document.getElementById("colorqid").style.display = show;

				document.getElementById("modelid").style.display = show;			
				document.getElementById("kmid").style.display = show;
				document.getElementById("modyearid").style.display = show;
				if(document.getElementById("hlid")!=null) document.getElementById("hlid").style.display = show;

				if(document.getElementById("promodelid")!=null) document.getElementById("promodelid").style.display = hide;
}


function createAjaxObj(){
var httprequest=false
if (window.XMLHttpRequest){ // if Mozilla, Safari etc
httprequest=new XMLHttpRequest()
if (httprequest.overrideMimeType)
httprequest.overrideMimeType('text/xml')
}
else if (window.ActiveXObject){ // if IE
try {
httprequest=new ActiveXObject("Msxml2.XMLHTTP");
} 
catch (e){
try{
httprequest=new ActiveXObject("Microsoft.XMLHTTP");
}
catch (e){}
}
}
return httprequest
}

var ajaxpack=new Object()
ajaxpack.basedomain="http://"+window.location.hostname
ajaxpack.ajaxobj=createAjaxObj()
ajaxpack.filetype="txt"
ajaxpack.addrandomnumber=0 //Set to 1 or 0. See documentation.

ajaxpack.getAjaxRequest=function(url, parameters, callbackfunc, filetype){
ajaxpack.ajaxobj=createAjaxObj() //recreate ajax object to defeat cache problem in IE
if (ajaxpack.addrandomnumber==1) //Further defeat caching problem in IE?
var parameters=parameters+"&ajaxcachebust="+new Date().getTime()
if (this.ajaxobj){
this.filetype=filetype
this.ajaxobj.onreadystatechange=callbackfunc
this.ajaxobj.open('GET', url+"?"+parameters, true)
this.ajaxobj.send(null)
}
}

ajaxpack.postAjaxRequest=function(url, parameters, callbackfunc, filetype){
ajaxpack.ajaxobj=createAjaxObj() //recreate ajax object to defeat cache problem in IE
if (this.ajaxobj){
this.filetype=filetype
this.ajaxobj.onreadystatechange = callbackfunc;
this.ajaxobj.open('POST', url, true);
this.ajaxobj.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
this.ajaxobj.setRequestHeader("Content-length", parameters.length);
this.ajaxobj.setRequestHeader("Connection", "close");
this.ajaxobj.send(parameters);
}
}

function submitUserForm(){
	if(userFormControl()){
		document.PF.submit();
	}
}

function userFormControl(){

	if(document.PF.FIRSTNAME.value.length==0){
		alert("LÜTFEN ADINIZI YAZINIZ");
		document.PF.FIRSTNAME.focus();
		return false;
	}

	if(document.PF.LASTNAME.value.length==0){
		alert("LÜTFEN SOYADINIZI YAZINIZ");
		document.PF.LASTNAME.focus();
		return false;
	}
	if(document.PF.EMAIL.value.length==0 || document.PF.EMAIL.value.indexOf('@')==-1 || (document.PF.EMAIL.value.indexOf('.com')==-1 && document.PF.EMAIL.value.indexOf('.net')==-1 && document.PF.EMAIL.value.indexOf('.COM')==-1 && document.PF.EMAIL.value.indexOf('.NET')==-1)){
		alert("LÜTFEN EMAIL ADRESINIZI KONTROL EDİNİZ");
		document.PF.EMAIL.focus();
		return false;
	}

	if(document.PF.URID.selectedIndex==5){
		alert("LÜTFEN ÜYELIK TIPINIZI SEÇINIZ. GALERI ISENIZ LÜTFEN SEÇINIZ AVANTAJLARINDAN FAYDALANINIZ.");
		document.PF.LASTNAME.focus();
		return false;
	}

	if(document.PF.URID.selectedIndex==1 && (document.PF.GALLERYNAME.value=='' || document.PF.GALLERYNAME.value.lenght<3)){
		alert("LÜTFEN GALERI ISMINI GIRINIZ.");
		document.PF.GALLERYNAME.focus();
		return false;
	}

	//if(document.PF.EMAIL2.value.length==0 || document.PF.EMAIL2.value.indexOf('@')==-1 || (document.PF.EMAIL2.value.indexOf('.com')==-1 && document.PF.EMAIL2.value.indexOf('.net')==-1 && document.PF.EMAIL2.value.indexOf('.COM')==-1 && document.PF.EMAIL2.value.indexOf('.NET')==-1)){
	//	alert("LÜTFEN TEKRAR EMAIL ADRESINIZI KONTROL EDİNİZ");
	//	document.PF.EMAIL2.focus();
	//	return false;
	//}

	if(document.PF.USERPASSWORD.value.length==0 || document.PF.USERPASSWORD.value.length<5){
		alert("LÜTFEN ŞİFRENİZİ YAZINIZ (En az 5 karakter)");
		document.PF.USERPASSWORD.focus();
		return false;
	}
	if(document.PF.USERPASSWORD2.value.length==0 || document.PF.USERPASSWORD.value.length<5){
		alert("LÜTFEN TEKRAR ŞİFRENİZİ YAZINIZ (En az 5 karakter)");
		document.PF.USERPASSWORD2.focus();
		return false;
	}
	if(document.PF.CITYID.value=='seciniz'){
		alert("LÜTFEN BULUNDUĞUNUZ ŞEHRİ SEÇİNİZ");
		document.PF.CITYID.focus();
		return false;
	}
	if(document.PF.COUNTYID.value.length==0){
		alert("LÜTFEN BULUNDUĞUNUZ SEMTİN ADINI YAZINIZ");
		document.PF.COUNTYID.focus();
		return false;
	}
	
	if(document.PF.HOMEPHONE.value.length==0 && document.PF.MOBILEPHONE.value.length==0 ){
		alert("EN AZ BİR (1) ADET TELEFON NUMARASI GİRİLMESİ ZORUNLUDUR");
		document.PF.HOMEPHONE.focus();
		return false;
	}

	if(document.PF.lic.value==1) {
		if(!document.PF.licence.checked){
			alert("LÜTFEN KULANIM SOZLEMESINI ONAYLAYINIZ");
			document.PF.licence.focus();
			return false;
		}
	}

	return true;
}

function submitUserFormUpdate(){
	if(userFormControlUpdate()){
		document.PF.submit();
	}
}

function userFormControlUpdate(){
	if(document.PF.FIRSTNAME.value.length==0){
		alert("LÜTFEN ADINIZI YAZINIZ");
		document.PF.FIRSTNAME.focus();
		return false;
	}

	if(document.PF.LASTNAME.value.length==0){
		alert("LÜTFEN SOYADINIZI YAZINIZ");
		document.PF.LASTNAME.focus();
		return false;
	}
	if(document.PF.EMAIL.value.length==0 || document.PF.EMAIL.value.indexOf('@')==-1 || (document.PF.EMAIL.value.indexOf('.com')==-1 && document.PF.EMAIL.value.indexOf('.net')==-1 && document.PF.EMAIL.value.indexOf('.COM')==-1 && document.PF.EMAIL.value.indexOf('.NET')==-1)){
		alert("LÜTFEN EMAIL ADRESINIZI KONTROL EDİNİZ");
		document.PF.EMAIL.focus();
		return false;
	}

	if(document.PF.URID.selectedIndex==1 && (document.PF.GALLERYNAME.value=='' || document.PF.GALLERYNAME.value.lenght<3)){
		alert("LÜTFEN GALERI ISMINI GIRINIZ.");
		document.PF.GALLERYNAME.focus();
		return false;
	}

	if(document.PF.CITYID.value=='seciniz'){
		alert("LÜTFEN BULUNDUĞUNUZ ŞEHRİ SEÇİNİZ");
		document.PF.CITYID.focus();
		return false;
	}
	if(document.PF.COUNTYID.value.length==0){
		alert("LÜTFEN BULUNDUĞUNUZ SEMTİN ADINI YAZINIZ");
		document.PF.COUNTYID.focus();
		return false;
	}
	
	if(document.PF.HOMEPHONE.value.length==0 && document.PF.MOBILEPHONE.value.length==0 ){
		alert("EN AZ BİR (1) ADET TELEFON NUMARASI GİRİLMESİ ZORUNLUDUR");
		document.PF.HOMEPHONE.focus();
		return false;
	}


	return true;
}


function submitUserLogin(){
	if(CheckUserLogin()){
		document.UML.submit();
	}
}

function CheckUserLogin(){
	if(document.UML.EMAIL.value.length==0){
		alert('EMAIL ADRESINIZI YAZINIZ');
		document.UML.EMAIL.focus();
		return false;
	}
	if(document.UML.USERPASSWORD.value.length==0){
		alert('ŞİFRENİZİ YAZINIZ');
		document.UML.USERPASSWORD.focus();
		return false;
	}
	
	return true;
}



function submitUserMiniLogin(){
	if(CheckUserMiniLogin()){
		document.UMLFORM.submit();
	}
}

function CheckUserMiniLogin(){
	if(document.UMLFORM.EMAIL.value.length==0){
		alert('EMAIL ADRES?N?Z? YAZINIZ');
		document.UMLFORM.EMAIL.focus(); 
		return false;
	}
	if(document.UMLFORM.USERPASSWORD.value.length==0){
		alert('ŞİFRENİZİ YAZINIZ');
		document.UMLFORM.USERPASSWORD.focus();
		return false;
	}	
	return true;
}

function submitAddProductForm(){
		if(CheckAddProduct()){
			document.PF.submit();
		}
}

function submitAddSearchingProductForm(){
	if(CheckAddSearchingProduct()){
		document.PF.submit();
	}
}

function CheckAddProduct(){
	if(document.PF.TYPE.value==0 && document.PF.MARKID.value=='seciniz'){
		alert('LÜTFEN MARKASINI SEÇİNİZ');
		document.PF.MARKID.focus();
		return false;
	}
	if(document.PF.TYPE.value==0 && document.PF.MODELID.value=='seciniz'){
		alert('LÜTFEN MODELİNİ SEÇİNİZ');
		document.PF.MODELID.focus();
		return false;
	}
	if(document.PF.CID.value=='seciniz'){
		alert('LÜTFEN TİPİ SEÇİNİZ');
		document.PF.CID.focus();
		return false;
	}
	if(document.PF.TYPE.value==0 && document.PF.CCID.value=='seciniz'){
		alert('LÜTFEN MOTOR HACMİNİ SEÇİNİZ');
		document.PF.CCID.focus();
		return false;
	}

	if(document.PF.TYPE.value==0 && document.PF.COLORID.value=='seciniz'){
		alert('LÜTFEN RENK SEÇİNİZ');
		document.PF.COLORID.focus();
		return false;
	}

	if(document.PF.TYPE.value==0 && isNaN(document.PF.KM.value)){
		alert('LÜTFEN AŞAĞIDAKİ HATALARI KONTROL EDİNİZ\nKM BOŞLUK BIRAKILAMAZ\nKM SIFIR (0) DAN BÜYÜK OLMALIDIR\nKM RAKAMLARDAN OLUŞMALIDIR');
		document.PF.KM.focus();
		return false;
	}

	if(document.PF.TYPE.value==0 && document.PF.MODYEAR.value=='seciniz'){
		alert('LÜTFEN YIL SEÇİNİZ');
		document.PF.COLORID.focus();
		return false;
	}

	if(document.PF.PRICE.value.length==0 || document.PF.PRICE.value == 0 || isNaN(document.PF.PRICE.value)){
		alert('LÜTFEN AŞAĞIDAKİ HATALARI KONTROL EDİNİZ\nFİYAT BOŞLUK BIRAKILAMAZ\nFİYAT SIFIR (0) DAN BÜYÜK OLMALIDIR\nFİYAT RAKAMLARDAN OLUŞMALIDIR');
		document.PF.PRICE.focus();
		return false;
	}

	if(document.PF.CITYID.value=='seciniz'){
		alert('LÜTFEN ŞEHİR SEÇİNİZ');
		document.PF.CITYID.focus();
		return false;
	}

	if(document.PF.COUNTYID.value.length==0){
		alert('LÜTFEN SEMT YAZINIZ');
		document.PF.COUNTYID.focus();
		return false;
	}

 
	if(document.PF.TYPE.value!=0 && (document.PF.PROMODEL.value.length==0 || document.PF.PROMODEL.value.length==0)){
		alert('LÜTFEN MARKA/MODEL YAZINIZ');
		document.PF.FIRSTNAME.focus();
		return false;
	}

	if(document.PF.FIRSTNAME.value.length==0 || document.PF.LASTNAME.value.length==0){
		alert('LÜTFEN AD-SOYAD YAZINIZ');
		document.PF.FIRSTNAME.focus();
		return false;
	}

	if(document.PF.EMAIL.value.length==0 || document.PF.EMAIL.value.indexOf('@')==-1 || (document.PF.EMAIL.value.indexOf('.com')==-1 && document.PF.EMAIL.value.indexOf('.net')==-1 && document.PF.EMAIL.value.indexOf('.COM')==-1 && document.PF.EMAIL.value.indexOf('.NET')==-1)){
		alert("LÜTFEN EMAIL ADRESINIZI KONTROL EDİNİZ");
		document.PF.EMAIL.focus();
		return false;
	}

	if(document.PF.PHONE1.value.length==0 && document.PF.PHONE2.value.length==0){
		alert("EN AZ BİR (1) ADET TELEFON NUMARASI GİRİLMESİ ZORUNLUDUR");
		document.PF.PHONE1.focus();
		return false;
	}
	return true;
}


function CheckAddSearchingProduct(){
	if(document.PF.PROMOTION.value.length==0){
		alert("LÜTFEN BA?LIK G?R?N?Z");
		document.PF.PROMOTION.focus();
		return false;
	}
	if(document.PF.MARKID.selectedIndex==111110){
		alert('LÜTFEN MARKA SEÇİNİZ');
		document.PF.MARKID.focus();
		return false;
	}
	if(document.PF.MODELID.selectedIndex==111110){
		alert('LÜTFEN MODEL SEÇİNİZ');
		document.PF.MODELID.focus();
		return false;
	}
	if(document.PF.DESCRIPTION.value.length==0){
		alert("LÜTFEN AÇIKLAMA G?R?N?Z");
		document.PF.DESCRIPTION.focus();
		return false;
	}
	if(document.PF.CITYID.selectedIndex==0){
		alert('LÜTFEN SEHİR SEÇİNİZ');
		document.PF.CITYID.focus();
		return false;
	}
	if(document.PF.COUNTYID.value.length==0){
		alert('LÜTFEN SEMT YAZINIZ');
		document.PF.COUNTYID.focus();
		return false;
	}
	return true;
}


function submitSearchOtherProductForm(){
	if(CheckSearchOtherProduct()){
		document.PF.submit();
	}
}

function CheckSearchOtherProduct(){

	if(document.PF.PRICE1.value.length==0){
		document.PF.PRICE1.value = 0;
	}
	if(document.PF.PRICE2.value.length==0){
		document.PF.PRICE2.value = 0;
	}
		
	if(isNaN(document.PF.PRICE1.value) || isNaN(document.PF.PRICE2.value)){
		alert('LÜTFEN FİYAT ALANINA RAKAM GİRİNİZ');
		document.PF.PRICE1.focus();
		return false;
	}

	if(parseInt(document.PF.PRICE1.value) > parseInt(document.PF.PRICE2.value)){
		alert('BİTİŞ FİYATI BAŞLANGIŞ FİYATINDAN KÜÇÜK OLAMAZ');
		document.PF.PRICE1.focus();
		return false;
	}
	
	return true;
}



function submitSearProductForm(basemilan){
	if(CheckSearchProduct()){
		if(document.PF.TYPE.selectedIndex==0)
			document.PF.action=basemilan + "/motosiklet";
		else if(document.PF.TYPE.selectedIndex==1)
			document.PF.action=basemilan + "/aksesuar-yedekparca";
		else if(document.PF.TYPE.selectedIndex==2)
			document.PF.action=basemilan + "/giyim";
		document.PF.submit();
	}
}

function submitSearchProductForm(){
	if(CheckSearchProduct()){
		document.PF.submit();
	}
}

function CheckSearchProduct(){

//	if(document.PF.MARKID.value=='seciniz'){
//		alert('LÜTFEN MARKASINI SEÇİNİZ');
//		document.PF.MARKID.focus();
//		return false;
//	}
	
	if(document.PF.KM1.value.length==0){
		document.PF.KM1.value = 0;
	}
	if(document.PF.KM2.value.length==0){
		document.PF.KM2.value = 0;
	}
		
	if(isNaN(document.PF.KM1.value) || isNaN(document.PF.KM2.value)){
		alert('LÜTFEN KM ALANINA RAKAM GİRİNİZ');
		document.PF.KM1.focus();
		return false;
	}

	if(parseInt(document.PF.KM1.value) > parseInt(document.PF.KM2.value)){
		alert('BİTİŞ KM BAŞLANGIŞ KM DEN KÜÇÜK OLAMAZ');
		document.PF.KM1.focus();
		return false;
	}
	
	if(document.PF.MODYEAR1.value!='seciniz' && document.PF.MODYEAR2.value!='seciniz'){
		if(parseInt(document.PF.MODYEAR1.value) > parseInt(document.PF.MODYEAR2.value)){
			alert('BİTİŞ YILI BAŞLANGIŞ YILINDAN KÜÇÜK OLAMAZ');
			document.PF.MODYEAR1.focus();
			return false;
		}
	}


	if(document.PF.PRICE1.value.length==0){
		document.PF.PRICE1.value = 0;
	}
	if(document.PF.PRICE2.value.length==0){
		document.PF.PRICE2.value = 0;
	}
		
	if(isNaN(document.PF.PRICE1.value) || isNaN(document.PF.PRICE2.value)){
		alert('LÜTFEN FİYAT ALANINA RAKAM GİRİNİZ');
		document.PF.PRICE1.focus();
		return false;
	}

	if(parseInt(document.PF.PRICE1.value) > parseInt(document.PF.PRICE2.value)){
		alert('BİTİŞ FİYATI BAŞLANGIŞ FİYATINDAN KÜÇÜK OLAMAZ');
		document.PF.PRICE1.focus();
		return false;
	}
	
	return true;

}

function submitMessageProductOwner(){
	if(CheckMessageProductOwner()){
		document.COMPOSEMESSAGE.submit();
	}
}

function CheckMessageProductOwner(){

	if(document.COMPOSEMESSAGE.SUBJECT.value.length==0){
		alert('LÜTFEN MESAJIN KONUSUNU YAZINIZ')
		document.COMPOSEMESSAGE.SUBJECT.focus();
		return false;
	}
	if(document.COMPOSEMESSAGE.MESSAGEBODY.value.length==0){
		alert('LÜTFEN MESAJIN İÇERİĞİNİ YAZINIZ')
		document.COMPOSEMESSAGE.MESSAGEBODY.focus();
		return false;
	}

	
	return true;
}
function submitEmailProductOwner(){
	if(CheckEmailProductOwner()){
		document.SM.action='/mp/process/email/sendEmailToProductOwner.jsp';
		document.SM.submit();
	}
}

function CheckEmailProductOwner(){

	if(document.SM.NAME.value.length==0){
		alert('LÜTFEN ADINIZI SOYADINIZI YAZINIZ')
		document.SM.NAME.focus();
		return false;
	}

	if(document.SM.EMAIL.value.length==0){
		alert('LÜTFEN E-MAIL ADRESİNİZİ YAZINIZ')
		document.SM.EMAIL.focus();
		return false;
	}

	if(document.SM.SUBJECT.value.length==0){
		alert('LÜTFEN E-MAILİN KONUSUNU YAZINIZ')
		document.SM.SUBJECT.focus();
		return false;
	}

	if(document.SM.BODY.value.length==0){
		alert('LÜTFEN E-MAILİN İÇERİĞİNİ YAZINIZ')
		document.SM.BODY.focus();
		return false;
	}

	
	return true;
}

function submitEmailToFriend(){
	if(CheckEmailToFriend()){
		document.SM.submit();
	}
}

function submitEmailActivation(){
	if(CheckEmailPassword()){
		document.SM.submit();
	}
}

function submitEmailPassword(){
	if(CheckEmailPassword()){
		document.SM.submit();
	}
}

function submitActivation(){
	if(CheckActivation()){
		document.SM.submit();
	}
}

function CheckEmailToFriend(){

	if(document.SM.NAME.value.length==0){
		alert('LÜTFEN ADINIZI SOYADINIZI YAZINIZ')
		document.SM.NAME.focus();
		return false;
	}

	if(document.SM.SEMAIL.value.length==0){
		alert('LÜTFEN E-MAIL ADRESİNİZİ YAZINIZ')
		document.SM.SEMAIL.focus();
		return false;
	}
	if(document.SM.EMAIL.value.length==0){
		alert('LÜTFEN ARKADAŞINIZIN E-MAIL ADRESİNİ YAZINIZ')
		document.SM.EMAIL.focus();
		return false;
	}
	
	return true;
}

function CheckEmailPassword(){
	if(document.SM.EMAIL.value.length==0){
		alert('LÜTFEN E-MAIL ADRESİNİZ? YAZINIZ')
		document.SM.EMAIL.focus();
		return false;
	}
	
	return true;
}

function CheckActivation(){
	if(document.SM.code.value.length==0){
		alert('LÜTFEN ETKINLESTIRME KODUNUZU YAZINIZ')
		document.SM.code.focus();
		return false;
	}
	
	return true;
}

function submitEmailProductError(){
	if(CheckEmailProductError()){
		document.SM.action='/mp/process/email/sendEmailToProductOwner.jsp';
		document.SM.submit();
	}
}

function CheckEmailProductError(){

	if(document.SM.NAME.value.length==0){
		alert('LÜTFEN ADINIZI SOYADINIZI YAZINIZ')
		document.SM.NAME.focus();
		return false;
	}

	if(document.SM.EMAIL.value.length==0){
		alert('LÜTFEN E-MAIL ADRESİNİZİ YAZINIZ')
		document.SM.EMAIL.focus();
		return false;
	}
	

	if(document.SM.BODY.value.length==0){
		alert('LÜTFEN E-MAILİN KONUSUNU YAZINIZ')
		document.SM.BODY.focus();
		return false;
	}
	
	return true;
}

function submitMessageCompose(){

	if(CheckMessageCompose()){
		document.COMPOSEMESSAGE.submit();
	}
}

function CheckMessageCompose(){

	if(document.COMPOSEMESSAGE.SUBJECT.value.length==0){
		alert('LÜTFEN MESAJIN KONUSUNU YAZINIZ')
		document.COMPOSEMESSAGE.SUBJECT.focus();
		return false;
	}

	if(document.COMPOSEMESSAGE.MESSAGEBODY.value.length==0){
		alert('LÜTFEN MESAJIN İÇERİĞİNİ YAZINIZ')
		document.COMPOSEMESSAGE.MESSAGEBODY.focus();
		return false;
	}
		
	return true;
}


function submitEmailToAdminForm(){
	if(checkEmailToAdminForm()){
		document.SM.submit();
	}
}

function checkEmailToAdminForm(){
	if(document.SM.NAME.value.length==0){
		alert("LUTFEN ADINIZI SOYADINIZI YAZINIZ");
		document.SM.NAME.focus();
		return false;
	}

	if(document.SM.EMAIL.value.length==0 || document.SM.EMAIL.value.indexOf('@')==-1 || (document.SM.EMAIL.value.indexOf('.com')==-1 && document.SM.EMAIL.value.indexOf('.net')==-1 && document.SM.EMAIL.value.indexOf('.COM')==-1 && document.SM.EMAIL.value.indexOf('.NET')==-1)){
		alert("LUTFEN EMAIL ADRESINIZI KONTROL EDINIZ");
		document.SM.EMAIL.focus();
		return false;
	}

	if(document.SM.SUBJECT.value.length==0){
		alert("LUTFEN GONDERECEGINIZ MESAJA BIR BASLIK YAZINIZ");
		document.SM.SUBJECT.focus();
		return false;
	}
	if(document.SM.MESSAGEBODY.value.length==0){
		alert("LUTFEN MESAJIN ICERIGINI YAZINIZ");
		document.SM.MESSAGEBODY.focus();
		return false;
	}

	return true;
}

function submitUserFormPasswordUpdate(){
	if(document.PF.USERPASSWORD.value.length==0){
		alert("LÜTFEN ESKI SIFRENIZI YAZINIZ");
		document.PF.USERPASSWORD.focus();
		return false;
	}
	if(document.PF.NEWUSERPASSWORD1.value.length==0){
		alert("LÜTFEN YENI SIFRENIZI YAZINIZ");
		document.PF.NEWUSERPASSWORD1.focus();
		return false;
	}
	if(document.PF.NEWUSERPASSWORD2.value.length==0){
		alert("LÜTFEN YENI SIFRENIZI TEKRAR YAZINIZ");
		document.PF.NEWUSERPASSWORD2.focus();
		return false;
	}
	document.PF.submit();
}

function submitNavigationModel(modelid,markid,cid) {
	document.PL.MODELID.value=modelid;
	document.PL.MARKID.value=markid;
	document.PL.CID.value=cid;
	document.PL.submit();
}
function submitNavigationMark(modelid,markid,cid) {
	document.PL.MODELID.value=modelid;
	document.PL.MARKID.value=markid;
	document.PL.CID.value=cid;
	document.PL.submit();	
}
function submitNavigationCategory(cid) {
	document.PL.MODELID.value='0';
	document.PL.MARKID.value=0;
	document.PL.CID.value=cid;
	document.PL.submit();		
}
function submitNavigationType(type) {
	document.PL.TYPE.value=type;
	document.PL.MODELID.value=0;
	document.PL.MARKID.value=0;
	document.PL.CID.value=0;
	document.PL.submit();		
}
function submitView(viewtype) {
	document.PL.VIEWTYPE.value=viewtype;
	document.PL.submit();		
}


function infoIconShow() {
			var div_info_icon = document.getElementById('div_info');
			div_info_icon.style.display 	= 'block';
}
var timeoutid;
		function infoIcon(e,str){
		
			if (!e) e = window.event;

			if (e){
			  if (e.pageX || e.pageY){
			  	screen_x = window.innerWidth - 16;
			  	screen_y = window.innerHeight - 16;
			    mousex = e.pageX + 15;
			    mousey = e.pageY;
			  }
			  else if (e.clientX || e.clientY){
			  	screen_x = document.body.offsetWidth - 20;
			  	screen_y = document.body.offsetHeight - 20;
			    mousex = e.clientX + document.body.scrollLeft + document.documentElement.scrollLeft;
			    mousey = e.clientY + document.body.scrollTop + document.documentElement.scrollTop;
			  }
			}

			var div_info_icon = document.getElementById('div_info');
			div_info_icon.style.textAlign	= 'center';
			div_info_icon.innerHTML	= str;

			var div_width = div_info_icon.style.width;
			var div_height = div_info_icon.offsetHeight;
			div_width = 180;

			//alert(screen_y+' - '+mousey+' - '+div_height);
			if ( screen_x - mousex  < div_width ){			
				//mousex = (mousex - div_width + 25);
				//mousey = mousey + 15;
			}
			if ( screen_y - mousey  < div_height ){
				//mousey = (mousey - div_height - 15);
			}

			div_info_icon.style.left 		= mousex+'px';
			div_info_icon.style.top 		= mousey+'px';
			timeoutid=setTimeout('infoIconShow()',750);

			//timeoutid1=setTimeout('infoIconClose()',7000);
			
			return false;

		}

		function infoIconClose(){
			clearTimeout(timeoutid);
			//clearTimeout(timeoutid1);
			var div_info_icon=document.getElementById('div_info');		
			div_info_icon.innerHTML= '';
			div_info_icon.style.display = 'none';
			return false;
		}
