function check_available()
{
	
document.getElementById('member_domain_address').value=document.myform.member_domain.value;	
	
divID='check_image';

dataSource='check_member.php?member_name='+document.myform.member_domain.value;	
	
dataSource = dataSource + "&time=" + new Date().getTime();	

var obj = document.getElementById(divID);	

if(XMLHttpRequestObject) {
XMLHttpRequestObject.open("GET", dataSource);
XMLHttpRequestObject.onreadystatechange = function()
{
if (XMLHttpRequestObject.readyState == 4 && XMLHttpRequestObject.status == 200) {
	
get_data=XMLHttpRequestObject.responseText;

if(get_data=='ok'){
obj.src = 'feed/accept.png' ;
}
else
{
obj.src = 'feed/delete.png' ;
}

}
}
XMLHttpRequestObject.send(null);
}

}


function ignoreSpaces(string) {
var temp = "";
string = '' + string;
splitstring = string.split(" ");
for(i = 0; i < splitstring.length; i++)
temp += splitstring[i];
return temp;
}

var bo_ns_id = 0;

function startIeFix(){
  if(isIE()){
    document.write('<div id="bo_ns_id_' + bo_ns_id + '"><!-- ');
  }
}

function endIeFix(){
  if(isIE()){
    document.write('</div>');
    var theObject = document.getElementById("bo_ns_id_" + bo_ns_id++);
    var theCode = theObject.innerHTML;
    theCode = theCode.substring(4 ,9+theCode.indexOf("</object>"))
    document.write(theCode);
  }
}

function isIE(){
  // only for Win IE 6+
  // But not in Windows 98, Me, NT 4.0, 2000
  var strBrwsr= navigator.userAgent.toLowerCase();
  if(strBrwsr.indexOf("msie") > -1 && strBrwsr.indexOf("mac") < 0){
    if(parseInt(strBrwsr.charAt(strBrwsr.indexOf("msie")+5)) < 6){
      return false;
    }
    if(strBrwsr.indexOf("win98") > -1 ||
       strBrwsr.indexOf("win 9x 4.90") > -1 ||
       strBrwsr.indexOf("winnt4.0") > -1 ||
       strBrwsr.indexOf("windows nt 5.0") > -1)
    {
      return false;
    }
    return true;
  }else{
    return false;
  }
}




function showpopup(form_selected,table_name){

selected_id=document.getElementById(form_selected).options[document.getElementById(form_selected).selectedIndex].value;	
		
if(selected_id=="-1"){
	
open_file='main_option.php?table_name='+table_name+'&set_id='+form_selected;	
	
window.open(open_file,'Title','toolbar=no,location=no, directories=no,status=no,menubar=no,scrollbars=yes, resizable=no,width=700,height=300,top=100, left=100'); 
	
}

}

function setCookie(name, value, expires, path, domain, secure) {
    document.cookie= name + "=" + escape(value) +
        ((expires) ? "; expires=" + expires.toGMTString() : "") +
        ((path) ? "; path=" + path : "") +
        ((domain) ? "; domain=" + domain : "") +
        ((secure) ? "; secure" : "");
}



function getCookie(name) {
    var dc = document.cookie;
    var prefix = name + "=";
    var begin = dc.indexOf("; " + prefix);
    if (begin == -1) {
        begin = dc.indexOf(prefix);
        if (begin != 0) return null;
    } else {
        begin += 2;
    }
    var end = document.cookie.indexOf(";", begin);
    if (end == -1) {
        end = dc.length;
    }
    return unescape(dc.substring(begin + prefix.length, end));
}


function deleteCookie(name, path, domain) {
    if (getCookie(name)) {
        document.cookie = name + "=" +
            ((path) ? "; path=" + path : "") +
            ((domain) ? "; domain=" + domain : "") +
            "; expires=Thu, 01-Jan-70 00:00:01 GMT";
    }
}

var phone_field_length=0;

function TabNext(obj,event,len,next_field,form_name) {
	if (event == "down") {
		phone_field_length=obj.value.length;
		}
	else if (event == "up") {
		if (obj.value.length != phone_field_length) {
			phone_field_length=obj.value.length;
			if (phone_field_length == len) {
				next_field.focus();
				}
			}
		}
	
	form_name.card_no.value=form_name.CC1.value+form_name.CC2.value+form_name.CC3.value+form_name.CC4.value;	
		
	}

var XMLHttpRequestObject = false;
if (window.XMLHttpRequest) {
XMLHttpRequestObject = new XMLHttpRequest();
} 
else if (window.ActiveXObject) {
XMLHttpRequestObject = new ActiveXObject("Microsoft.XMLHTTP");
}

function go_link(link_name){
	
window.location=link_name;	
	
}

function checkAll(theForm, check,class_name) {
    for (i=0,n=theForm.elements.length;i<n;i++){
    	if (theForm.elements[i].className.indexOf(class_name) !=-1){
          theForm.elements[i].checked = check;
      }
	}
}

function div_process(dataSource,picture_name,divID){
	
dataSource = dataSource + "&time=" + new Date().getTime();	
	
var obj = document.getElementById(divID);	

obj.src='images/progressbar_100.gif';
	
if(XMLHttpRequestObject) {
XMLHttpRequestObject.open("GET", dataSource);
XMLHttpRequestObject.onreadystatechange = function()
{
if (XMLHttpRequestObject.readyState == 4 && XMLHttpRequestObject.status == 200) {
	
get_data=XMLHttpRequestObject.responseText;

obj.src=picture_name;

}
}
XMLHttpRequestObject.send(null);
}
		
}

function div_ajax(dataSource,to_div){
		
var obj = document.getElementById(to_div);	

obj.innerHTML='<div class=div_box><center><img src=images/progressbar.gif> açılır...</div>';

if(XMLHttpRequestObject) {
XMLHttpRequestObject.open("GET", dataSource);
XMLHttpRequestObject.onreadystatechange = function()
{
if (XMLHttpRequestObject.readyState == 4 && XMLHttpRequestObject.status == 200) {
	
get_data=XMLHttpRequestObject.responseText;

obj.innerHTML=get_data;

obj.style.display='';

}
}
XMLHttpRequestObject.send(null);
}

}


function iso88599Escape(strText)
{

strText=escape(strText);
strText=strText.replace(/ı/g,"%C4%B1");
strText=strText.replace(/Ü/g,"%C3%9C");
strText=strText.replace(/ü/g,"%C3%BC");
strText=strText.replace(/ğ/g,"%C4%9F");
strText=strText.replace(/Ğ/g,"%C49E%");
strText=strText.replace(/ü/g,"%C3%BC");
strText=strText.replace(/Ü/g,"%C3%9C");
strText=strText.replace(/İ/g,"%C4%B0");
strText=strText.replace(/ş/g,"%C5%9F");
strText=strText.replace(/Ş/g,"%C5%9E");
strText=strText.replace(/ç/g,"%C3%A7");
strText=strText.replace(/Ç/g,"%C3%87");
strText=strText.replace(/ö/g,"%C3%B6");
strText=strText.replace(/Ö/g,"%C3%96");
return strText;
}


function tag_it(section_code,tag_code){
			
var to_input = document.getElementById('tag_value');	

var to_obj = document.getElementById('tag_content');	

var to_entry = document.getElementById('tag_entry');	

if(to_input.value!=''){	

to_entry.innerHTML='<img src=images/loading.gif>';

base=to_input.value+'|'+section_code+'|'+tag_code;

base=Base64.encode(base);

dataSource='tag_it.php?enc='+base;

if(XMLHttpRequestObject) {

XMLHttpRequestObject.open("GET", dataSource);

XMLHttpRequestObject.onreadystatechange = function()

{

if (XMLHttpRequestObject.readyState == 4 && XMLHttpRequestObject.status == 200) {
	
get_data=XMLHttpRequestObject.responseText;

to_obj.innerHTML=get_data;

to_input.value='';

to_entry.innerHTML='<input type=text name=tag_value id=tag_value> <input type=submit value="elave et" onclick=tag_it(\'photo_code\',\''+tag_code+'\')>';

}

}

XMLHttpRequestObject.send(null);

}

}
else
{
alert('En az 3 herfli söz yazın');
}

}

var Base64 = {

	// private property
	_keyStr : "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",

	// public method for encoding
	encode : function (input) {
		var output = "";
		var chr1, chr2, chr3, enc1, enc2, enc3, enc4;
		var i = 0;

		input = Base64._utf8_encode(input);

		while (i < input.length) {

			chr1 = input.charCodeAt(i++);
			chr2 = input.charCodeAt(i++);
			chr3 = input.charCodeAt(i++);

			enc1 = chr1 >> 2;
			enc2 = ((chr1 & 3) << 4) | (chr2 >> 4);
			enc3 = ((chr2 & 15) << 2) | (chr3 >> 6);
			enc4 = chr3 & 63;

			if (isNaN(chr2)) {
				enc3 = enc4 = 64;
			} else if (isNaN(chr3)) {
				enc4 = 64;
			}

			output = output +
			this._keyStr.charAt(enc1) + this._keyStr.charAt(enc2) +
			this._keyStr.charAt(enc3) + this._keyStr.charAt(enc4);

		}

		return output;
	},

	// public method for decoding
	decode : function (input) {
		var output = "";
		var chr1, chr2, chr3;
		var enc1, enc2, enc3, enc4;
		var i = 0;

		input = input.replace(/[^A-Za-z0-9\+\/\=]/g, "");

		while (i < input.length) {

			enc1 = this._keyStr.indexOf(input.charAt(i++));
			enc2 = this._keyStr.indexOf(input.charAt(i++));
			enc3 = this._keyStr.indexOf(input.charAt(i++));
			enc4 = this._keyStr.indexOf(input.charAt(i++));

			chr1 = (enc1 << 2) | (enc2 >> 4);
			chr2 = ((enc2 & 15) << 4) | (enc3 >> 2);
			chr3 = ((enc3 & 3) << 6) | enc4;

			output = output + String.fromCharCode(chr1);

			if (enc3 != 64) {
				output = output + String.fromCharCode(chr2);
			}
			if (enc4 != 64) {
				output = output + String.fromCharCode(chr3);
			}

		}

		output = Base64._utf8_decode(output);

		return output;

	},

	// private method for UTF-8 encoding
	_utf8_encode : function (string) {
		string = string.replace(/\r\n/g,"\n");
		var utftext = "";

		for (var n = 0; n < string.length; n++) {

			var c = string.charCodeAt(n);

			if (c < 128) {
				utftext += String.fromCharCode(c);
			}
			else if((c > 127) && (c < 2048)) {
				utftext += String.fromCharCode((c >> 6) | 192);
				utftext += String.fromCharCode((c & 63) | 128);
			}
			else {
				utftext += String.fromCharCode((c >> 12) | 224);
				utftext += String.fromCharCode(((c >> 6) & 63) | 128);
				utftext += String.fromCharCode((c & 63) | 128);
			}

		}

		return utftext;
	},

	// private method for UTF-8 decoding
	_utf8_decode : function (utftext) {
		var string = "";
		var i = 0;
		var c = c1 = c2 = 0;

		while ( i < utftext.length ) {

			c = utftext.charCodeAt(i);

			if (c < 128) {
				string += String.fromCharCode(c);
				i++;
			}
			else if((c > 191) && (c < 224)) {
				c2 = utftext.charCodeAt(i+1);
				string += String.fromCharCode(((c & 31) << 6) | (c2 & 63));
				i += 2;
			}
			else {
				c2 = utftext.charCodeAt(i+1);
				c3 = utftext.charCodeAt(i+2);
				string += String.fromCharCode(((c & 15) << 12) | ((c2 & 63) << 6) | (c3 & 63));
				i += 3;
			}

		}

		return string;
	}

}


function close_div(to_div){
		
var obj = document.getElementById(to_div);	

obj.style.display='none';

}


function opener_go(go_link){
	
opener.location.href=go_link;
window.close();	
	
}

function cancel_cat(category_id){

old_id=document.getElementById('cancel_array').value;

new_id=old_id+'|'+category_id;
	
document.getElementById('cancel_array').value=new_id;

document.getElementById(category_id).style.display='none';

}

function apply_cat(category_id,category_name){
	
old_category=opener.document.getElementById('category_choose').innerHTML;	

new_category=old_category+'<div style=padding:2px id='+category_id+'>'+	category_name+' <a href=# onclick=cancel_cat('+category_id+')>[ x ]</a></div>';

old_id=opener.document.getElementById('category_array').value;

new_id=old_id+'|'+category_id;
	
opener.document.getElementById('category_choose').innerHTML=new_category;

opener.document.getElementById('category_array').value=new_id;

window.close();	
	
}

function close_refresh(){

opener.location.reload()	
window.close();	

}


function check_security()
{
	
dataSource='check_security.php?refid='+document.myform.security_refid.value+'&try='+document.myform.security_try.value;	

dataSource = dataSource + "&time=" + new Date().getTime();	

if(XMLHttpRequestObject) {
XMLHttpRequestObject.open("GET", dataSource);
XMLHttpRequestObject.onreadystatechange = function()
{
if (XMLHttpRequestObject.readyState == 4 && XMLHttpRequestObject.status == 200) {

get_data=XMLHttpRequestObject.responseText;

if(get_data=='ok'){
document.myform.security.value='2';	
}
else
{
document.myform.security.value='1';		
}

}
}
XMLHttpRequestObject.send(null);
}

}

function remove_content(deger){
	
	deger.value='';
	
}	

function ConfirmChoice(link) 

{ 

answer = confirm("Silmek istediğinizden emin misiniz?")

if (answer !=0) 

{ 

location = link 

} 

}

function open_window(theURL,x,y) { 
window.open(theURL,'Title','toolbar=no,location=no, directories=no,status=no,menubar=no,scrollbars=yes, resizable=no,width='+x+',height='+y+',top=100, left=100'); 
} 

function checkform(file_id,element_id,size_id,nos)
{
		
		img_url=document.getElementById(file_id).value;
		
		document.getElementById(element_id).src="file:///"+img_url;	
		
		document.getElementById('form_process').disabled=false;
	
		document.getElementById(size_id).innerHTML='<u>Resim '+nos;
	
}


function check_pass(form_name) { 
	
	var pass_len=form_name.member_pass.value;
	HataMesaji = "";
	Sayac = 0;
	
	
if(form_name.old_password.value==''){
	
	HataMesaji += "- Lütfen eski şifrenizi giriniz.\n";
	Sayac++;
}		
	
if(pass_len.length<5 || form_name.member_pass.value==''){
	
	HataMesaji += "- Yeni kullanıcı şifresi 5 karakterden az olmamalıdır.\n";
	Sayac++;
}	

if(form_name.member_pass.value==form_name.member_pass_repeat.value){
	
}
else
{

	HataMesaji += "- Şifre ve tekrar şifreniz aynı değildir.\n";
	Sayac++;

}

	if(HataMesaji != "")
	{
		if(Sayac > 1)
			tmp = "";
		else
			tmp = "";
			
		alert(HataMesaji)
		
	}
	else
	{
			
	form_name.submit();
	
	}

}

function check_field() { 
	
	var member_len=document.myform.member_name.value;
	var pass_len=document.myform.member_pass.value;
	var email_len=document.myform.member_email.value;

	HataMesaji = "";
	Sayac = 0;
	
	
if(document.myform.member_check.value=='2'){
		HataMesaji += "- İstifade olunmuş bir üzvlük adı yazdınız.\n";
		Sayac++;
}
	
	
if(document.myform.member_mobile.value==''){
		HataMesaji += "- Xahiş edirik mobil telefon nömresini yazın.\n";
		Sayac++;
}

if(member_len.length>20){
	
	HataMesaji += "- Üzvlük adı 20 herfden çox olmamalıdır.\n";
	Sayac++;
}

if(member_len.length<5 || document.myform.member_name.value==''){
	
	HataMesaji += "- Üzvlük adı 5 herfden az olmamalıdır.\n";
	Sayac++;
}

if(pass_len.length>20){
	
	HataMesaji += "- Mexfi söz 20 herfden çox ola bilmez.\n";
	Sayac++;
}

if(pass_len.length<5 || document.myform.member_pass.value==''){
	
	HataMesaji += "- Mexfi söz 5 herfden az olmamalıdır.\n";
	Sayac++;
}	


if(document.myform.member_email.value=='' || document.myform.member_email.value.indexOf("@")==-1 || document.myform.member_email.value.indexOf(".")==-1){
		HataMesaji += "- Xahiş edirik istifade etdiyiniz düz email adresi yazın.\n";
		Sayac++;
}

if(email_len.length>50){
	
	HataMesaji += "- Email ünvanı 50 herfden çox olmamalıdır.\n";
	Sayac++;
	
}

if(document.myform.city_id.options[document.myform.city_id.selectedIndex].value==0){

	HataMesaji += "- Xahiş edirik şeher seçin.\n";
	Sayac++;

}

if(document.myform.security_try.value==''){
		HataMesaji += "- Xahiş edirik kontrol kodu yazınız.\n";
		Sayac++;
}
else
{

if(document.myform.security.value==1){
		HataMesaji += "- Sehv kontrol kodu yazdınız.\n";
		Sayac++;
}		
		
}



if(document.myform.member_pass.value==document.myform.member_pass_repeat.value){
	
}
else
{

	HataMesaji += "- Yazdığınız mexfi sözler eyni deyil.\n";
	Sayac++;

}


	if(HataMesaji != "")
	{
		if(Sayac > 1)
			tmp = "";
		else
			tmp = "";
			
		alert(HataMesaji)
		
	}
	else
	{
			
	document.myform.submit();
	
	}

}

function submit_form(form_name){

form_name.submit();

}

function set_content(content,div_name){
	
 document.getElementById(div_name).innerHTML=content;	
	
}

function ajax_position(dataSource){
	
var arrayPageSize = getPageSize();	

var obj=document.getElementById('ajax_content');	

newposx=arrayPageSize[3]/2;

obj.style.left=newposx+200;	

obj.style.top='100';	

obj.style.display='';	
	
if(XMLHttpRequestObject) {
XMLHttpRequestObject.open("GET", dataSource);
XMLHttpRequestObject.onreadystatechange = function()
{
if (XMLHttpRequestObject.readyState == 4 && XMLHttpRequestObject.status == 200) {
	
get_data=XMLHttpRequestObject.responseText;

obj.innerHTML=get_data;

obj.style.display='';

}
}
XMLHttpRequestObject.send(null);
}
	
}


function getPageSize(){
	
	var xScroll, yScroll;
	
	if (window.innerHeight && window.scrollMaxY) {	
		xScroll = document.body.scrollWidth;
		yScroll = window.innerHeight + window.scrollMaxY;
	} else if (document.body.scrollHeight > document.body.offsetHeight){ // all but Explorer Mac
		xScroll = document.body.scrollWidth;
		yScroll = document.body.scrollHeight;
	} else { // Explorer Mac...would also work in Explorer 6 Strict, Mozilla and Safari
		xScroll = document.body.offsetWidth;
		yScroll = document.body.offsetHeight;
	}
	
	var windowWidth, windowHeight;
	if (self.innerHeight) {	// all except Explorer
		windowWidth = self.innerWidth;
		windowHeight = self.innerHeight;
	} else if (document.documentElement && document.documentElement.clientHeight) { // Explorer 6 Strict Mode
		windowWidth = document.documentElement.clientWidth;
		windowHeight = document.documentElement.clientHeight;
	} else if (document.body) { // other Explorers
		windowWidth = document.body.clientWidth;
		windowHeight = document.body.clientHeight;
	}	
	
	// for small pages with total height less then height of the viewport
	if(yScroll < windowHeight){
		pageHeight = windowHeight;
	} else { 
		pageHeight = yScroll;
	}

	// for small pages with total width less then width of the viewport
	if(xScroll < windowWidth){	
		pageWidth = windowWidth;
	} else {
		pageWidth = xScroll;
	}


	arrayPageSize = new Array(pageWidth,pageHeight,windowWidth,windowHeight) 
	return arrayPageSize;
}


function do_action(go_action){

document.basket_form.action=go_action;
document.basket_form.submit();

}


function set_action(form_action,go_action){

document.getElementById('action_set').value=go_action;	
form_action.submit();

}


var options;
var ids;

function getOptions()
{
	
times=new Date().getTime();	

if(XMLHttpRequestObject) {
XMLHttpRequestObject.open("GET",'city_option.php?country_code='+document.myform.country_code.options[document.myform.country_code.selectedIndex].value+'&times'+times);
XMLHttpRequestObject.onreadystatechange = function()
{
if (XMLHttpRequestObject.readyState == 4 &&XMLHttpRequestObject.status == 200) {
var xmlDocument = XMLHttpRequestObject.responseXML;
options = xmlDocument.getElementsByTagName("option");
ids = xmlDocument.getElementsByTagName("id");
listOptions();
}
}
XMLHttpRequestObject.send(null);
}
}

function listOptions ()
{
	

var cityChooser = document.myform.elements["city_code"];

while (cityChooser.options.length) {
cityChooser.remove(0);
}
	
	
var loopIndex;
var selectControl = document.getElementById('city_code');
for (loopIndex = 0; loopIndex < options.length; loopIndex++ )
{
id_give=ids[loopIndex].firstChild.data;
selectControl.options[loopIndex] = new Option(options[loopIndex].firstChild.data,id_give);
}
}


function open_window(theURL,x,y) { 

window.open(theURL,'Title','toolbar=no,location=no, directories=no,status=no,menubar=no,scrollbars=yes, resizable=no,width='+x+',height='+y+',top=100, left=100'); 

}

function choose_category() { 
	
theURL='choose_index.php';	

window.open(theURL,'Title','toolbar=no,location=no, directories=no,status=no,menubar=no,scrollbars=yes, resizable=no,width=300,height=500,top=100, left=100'); 

}
  
