function jspost(url,query,target){
if(window.ActiveXObject){
xmlhttp = new ActiveXObject('Microsoft.XMLHTTP');
}
else if(window.XMLHttpRequest){
xmlhttp = new XMLHttpRequest();
}
xmlhttp.open('POST',url,true);
xmlhttp.setRequestHeader('Content-Type','application/x-www-form-urlencoded;');
xmlhttp.send(query);
xmlhttp.onreadystatechange = function(){
target.innerHTML ='...';
if(xmlhttp.readyState == 4){
if(xmlhttp.status == 200){
target.innerHTML = xmlhttp.responseText;
}
}
}
}
var geocoder;
var map;
function gmapload(lat,lng,zoom){
map=new GMap2(document.getElementById('map'));
var center=new GLatLng(lat,lng);
map.setCenter(center,zoom);
marker=new GMarker(center);
map.addOverlay(marker);
GEvent.addListener(map,'click',function(overlay,point){
if(point){
map.clearOverlays(point);
map.addOverlay(new GMarker(point));
var LongPoint=point.x;
var LatPoint=point.y;
document.forms.formf.enlem.value=LatPoint;
document.forms.formf.boylam.value=LongPoint;
}
});
geocoder=new GClientGeocoder();
map.enableScrollWheelZoom();
map.addControl(new GSmallMapControl());
map.addControl(new GMapTypeControl());
}
function gmapconfirm(){
if(document.forms.formf.enlem.value || document.forms.formf.boylam.value){
var answer=confirm('Haritada yaptığınız seçimi iptal etmek istediğinize emin misiniz ?');
if(answer){
document.forms.formf.enlem.value='';
document.forms.formf.boylam.value='';
blendonoff('gmap');
gmapload(38.963745,35.243322,5);
}
}
else{
blendonoff('gmap');
gmapload(38.963745,35.243322,5);
gmapautosearch();
}
}
function gmapget(response){
map.clearOverlays();
if(!response || response.Status.code != 200){
alert('Aradığınız adres bulunamadı\nil, ilçe yazarak arama yapabilir,\nçift tıklama yaparak aradığınız adresi yakınlaştırabilirsiniz');
document.forms.formf.gmapsearchquery.focus();
}
else{
place=response.Placemark[0];
point=new GLatLng(place.Point.coordinates[1],
place.Point.coordinates[0]);
marker=new GMarker(point);
map.addOverlay(marker);
marker.openInfoWindowHtml('<h5 title="Haritada arama sonucu">Haritada arama sonucu</h5><h2 title="'+ place.address +'" class="ttitle">'+ place.address +'</h2>');
}
}
function gmapsearch(gmapsearchquery){
var gmapsearchquery='Türkiye, '+gmapsearchquery;
geocoder.getLocations(gmapsearchquery,gmapget);
}
function gmapautosearch(){
var il=document.getElementById('il').options[document.getElementById('il').selectedIndex].value;
var ilce=document.getElementById('ilce').options[document.getElementById('ilce').selectedIndex].value;
var ilquery=il+', ';
var ilcequery=ilce.replace('MERKEZ', '');
if(ilcequery){
var ilcequery=ilcequery+', ';
}
var gmapsearchquery=ilquery+ilcequery;
if(il && (ilce && ilce!=0)){
document.forms.formf.gmapsearchquery.value=gmapsearchquery;
gmapsearch(gmapsearchquery);
map.setCenter(new GLatLng(38.963745,35.243322),12);
}
}
function textcounter(field,maxlength,charlength){
if(field.value.length > maxlength){
field.value=field.value.substring(0,maxlength);
}
else{
document.getElementById(charlength).innerHTML=maxlength - field.value.length;
}
}
function isnum(str){
for(var i=0; i<str.length; i++){
var ch=str.charAt(i);
if('0123456789'.indexOf(ch)==-1){
return false;
}
}
return true;
}
function isvalidemail(str){
if(str.search(/^\w+((-\w+)|(\.\w+))*\@[A-Za-z0-9]+((\.|-)[A-Za-z0-9]+)*\.[A-Za-z0-9]+$/) != -1){
return true;
}
else{
return false;
}
}
function isvalidurl(str){
if(str.search(/^\w+((-\w+)|(\.\w+))*\.[A-Za-z0-9]+((\.|-)[A-Za-z0-9]+)*\.[A-Za-z0-9]+$/) != -1){
return true;
}
else{
return false;
}
}
function submitm(){
if (document.forms.formm.mesaj.value.length < 7){alert('Mesajınızı yazmadınız');document.forms.formm.mesaj.focus();return false;}
if (document.forms.formm.ad.value.length < 3){alert('Adınızı - Soyadınızı yazmadınız');document.forms.formm.ad.focus();return false;}
if (document.forms.formm.tel.value.length < 11){alert('Telefon numaranızı yazmadınız\n[Örnek: 0123 1234567]');document.forms.formm.tel.focus();return false;}
if (document.forms.formm.eposta.value.length < 7){alert('E-posta adresinizi yazmadınız\n[Örnek: iletisim@kirmiziinsaat.com]');document.forms.formm.eposta.focus();return false;}
if (!isvalidemail(document.forms.formm.eposta.value)){alert('E-posta adresinizi yanlış yazdınız\n[Örnek: iletisim@kirmiziinsaat.com]');document.forms.formm.eposta.focus();return false;}
if (document.forms.formm.cevap.value.length < 1){alert('Form doğrulama işleminin cevabını yazmadınız');document.forms.formm.cevap.focus();return false;}
if (!isnum(document.forms.formm.cevap.value)){alert('Form doğrulama işleminin cevabını yanlış yazdınız');document.forms.formm.cevap.focus();return false;}
return true;
}
function submity(){
if (document.forms.formy.yorum.value.length < 7){alert('Yorumunuzu yazmadınız');document.forms.formy.yorum.focus();return false;}
if (document.forms.formy.ad.value.length < 3){alert('Adınızı - Soyadınızı yazmadınız');document.forms.formy.ad.focus();return false;}
if (document.forms.formy.eposta.value){
if (document.forms.formy.eposta.value.length < 7){alert('E-posta adresinizi yanlış yazdınız\n[Örnek: iletisim@kirmiziinsaat.com]\n[Bu alanı boş bırakabilirsiniz]');document.forms.formy.eposta.focus();return false;}
if (!isvalidemail(document.forms.formy.eposta.value)){alert('E-posta adresinizi yanlış yazdınız\n[Örnek: iletisim@kirmiziinsaat.com]\n[Bu alanı boş bırakabilirsiniz]');document.forms.formy.eposta.focus();return false;}
}
if (document.forms.formy.cevap.value.length < 1){alert('Form doğrulama işleminin cevabını yazmadınız');document.forms.formy.cevap.focus();return false;}
if (!isnum(document.forms.formy.cevap.value)){alert('Form doğrulama işleminin cevabını yanlış yazdınız');document.forms.formy.cevap.focus();return false;}
return true;
}
function submiti(){
if (document.forms.formi.mesaj.value.length < 7){alert('Mesajınızı yazmadınız');document.forms.formi.mesaj.focus();return false;}
if (document.forms.formi.ad.value.length < 3){alert('Adınızı yazmadınız');document.forms.formi.ad.focus();return false;}
if (document.forms.formi.eposta.value.length < 7){alert('E-posta adresinizi yazmadınız\n[Örnek: iletisim@kirmiziinsaat.com]');document.forms.formi.eposta.focus();return false;}
if (!isvalidemail(document.forms.formi.eposta.value)){alert('E-posta adresinizi yanlış yazdınız\n[Örnek: iletisim@kirmiziinsaat.com]');document.forms.formi.eposta.focus();return false;}
if (document.forms.formi.cevap.value.length < 1){alert('Form doğrulama işleminin cevabını yazmadınız');document.forms.formi.cevap.focus();return false;}
if (!isnum(document.forms.formi.cevap.value)){alert('Form doğrulama işleminin cevabını yanlış yazdınız');document.forms.formi.cevap.focus();return false;}
return true;
}
function submitf(){
if (document.forms.formf.kategori_id.selectedIndex==0){alert('Firmanızın faaliyet gösterdiği sektörü seçmediniz');document.forms.formf.kategori_id.focus();return false;}
if (document.forms.formf.firma_adi.value.length < 3){alert('Firmanızın adını yazmadınız');document.forms.formf.firma_adi.focus();return false;}
if (document.forms.formf.il.selectedIndex==0){alert('Firmanızın bulunduğu ili seçmediniz');document.forms.formf.il.focus();return false;}
if (document.forms.formf.ilce.selectedIndex==0){alert('Firmanızın bulunduğu ilçeyi seçmediniz');document.forms.formf.ilce.focus();return false;}
if (document.forms.formf.adres.value.length < 7){alert('Firmanızın adresini yazmadınız');document.forms.formf.adres.focus();return false;}
if (document.forms.formf.telkod.value.length < 4){alert('Firmanızın telefon numarasının, alan kodunu yazmadınız\n[Örnek: 0123]');document.forms.formf.telkod.focus();return false;}
if (!isnum(document.forms.formf.telkod.value)){alert('Firmanızın telefon numarasının, alan kodunu yanlış yazdınız\n[Örnek: 0123]');document.forms.formf.telkod.focus();return false;}
if (document.forms.formf.tel.value.length < 7){alert('Firmanızın telefon numarasını yazmadınız\n[Örnek: 1234567]');document.forms.formf.tel.focus();return false;}
if (!isnum(document.forms.formf.tel.value)){alert('Firmanızın telefon numarasını yanlış yazdınız\n[Örnek: 1234567]');document.forms.formf.tel.focus();return false;}
if (document.forms.formf.faks.value){
if (document.forms.formf.faks.value.length < 7){alert('Firmanızın faks numarasını yanlış yazdınız\n[Örnek: 1234567]\n[Bu alanı boş bırakabilirsiniz]');document.forms.formf.faks.focus();return false;}
if (!isnum(document.forms.formf.faks.value)){alert('Firmanızın faks numarasını yanlış yazdınız\n[Örnek: 1234567]\n[Bu alanı boş bırakabilirsiniz]');document.forms.formf.faks.focus();return false;}
}
if (document.forms.formf.eposta.value.length < 7){alert('Firmanızın e-posta adresini yazmadınız\n[Örnek: iletisim@kirmiziinsaat.com]');document.forms.formf.eposta.focus();return false;}
if (!isvalidemail(document.forms.formf.eposta.value)){alert('Firmanızın e-posta adresini yanlış yazdınız\n[Örnek: iletisim@kirmiziinsaat.com]');document.forms.formf.eposta.focus();return false;}
if (document.forms.formf.site.value){
if (document.forms.formf.site.value.length < 7){alert('Firmanızın internet sitesinin adresini yanlış yazdınız\n[Örnek: www.kirmiziinsaat.com]\n[Bu alanı boş bırakabilirsiniz]');document.forms.formf.site.focus();return false;}
if (!isvalidurl(document.forms.formf.site.value)){alert('Firmanızın internet sitesinin adresini yanlış yazdınız\n[Örnek: www.kirmiziinsaat.com]\n[Bu alanı boş bırakabilirsiniz]');document.forms.formf.site.focus();return false;}
}
if (document.forms.formf.etiket1.value.length < 3){alert('Ürün veya hizmetlerinizden "1" tanesini yazın');document.forms.formf.etiket1.focus();return false;}
if (document.forms.formf.etiket2.value.length < 3){alert('Ürün veya hizmetlerinizden "1" tanesini daha yazın');document.forms.formf.etiket2.focus();return false;}
if (document.forms.formf.cevap.value.length < 1){alert('Form doğrulama işleminin cevabını yazmadınız');document.forms.formf.cevap.focus();return false;}
if (!isnum(document.forms.formf.cevap.value)){alert('Form doğrulama işleminin cevabını yanlış yazdınız');document.forms.formf.cevap.focus();return false;}
return true;
}