	function checkLogin(URL){
		if (
			URL.bayikodu.value =='' || 
			URL.username.value =='' || 
			URL.password.value =='' 
		) { 
			alert('Üyelik giriş için Bayi Kodu, Üye Adınızı ve Şifrenizi boş geçmeyiniz.'); 
			return false;
		}
		return true;
	}

	function getCheckedValue(radioObj) {
		if(!radioObj)
			return "";
		var radioLength = radioObj.length;
		if(radioLength == undefined)
			if(radioObj.checked)
				return radioObj.value;
			else
				return "";
		for(var i = 0; i < radioLength; i++) {
			if(radioObj[i].checked) {
				return radioObj[i].value;
			}
		}
		return "";
	}

	function setCheckedValue(radioObj, newValue) {
		if(!radioObj)
			return;
		var radioLength = radioObj.length;
		if(radioLength == undefined) {
			radioObj.checked = (radioObj.value == newValue.toString());
			return;
		}
		for(var i = 0; i < radioLength; i++) {
			radioObj[i].checked = false;
			if(radioObj[i].value == newValue.toString()) {
				radioObj[i].checked = true;
			}
		}
	}

	function ustarabul(URL){
	  kelime = URL.kelime.value;
	  kategori = URL.kategori.options[URL.kategori.selectedIndex].value;
	  markaid = URL.markaid.options[URL.markaid.selectedIndex].value;

	  yol = '';	
	  if (kelime != '') yol += '&kelime='+kelime;
	  if (kategori != '') yol += kategori;
	  if (markaid != '') yol += '&markaid='+markaid;
	  if (yol != '') location.href = './?search=true'+yol;
	  else {
		  alert('Ürün aramak için anahtar kategori, marka yada anahtar bir kelime seçmelisiniz.');
		  return;
	  }
	}

	function ortaarabul(URL,path){
	  kelime = URL.kelime.value;
	  if(kelime =='bu kelimeyi ara..') { kelime = ''; }
	  if (URL.grupid.selectedIndex !=-1) { grupid = URL.grupid.options[URL.grupid.selectedIndex].value };
	  if (URL.altgrupid.selectedIndex !=-1) { altgrupid = URL.altgrupid.options[URL.altgrupid.selectedIndex].value };
	  if (URL.markaid.selectedIndex !=-1) { markaid = URL.markaid.options[URL.markaid.selectedIndex].value };

	  yol = '';	
	  if (kelime != '') yol += '&kelime='+kelime;
	  if (grupid != '') yol += '&grupid='+grupid;
	  if (altgrupid != '') yol += '&altgrupid='+altgrupid;
	  if (markaid != '') yol += '&markaid='+markaid;
	  if (yol != '') location.href = path + '?search=true'+yol;
	  else {
		  alert('Ürün aramak için anahtar ana ürün grubu, alt ürün grubu, marka grubu yada anahtar bir kelime seçmelisiniz.');
		  return;
	  }
	}

	function ortaarabul_yonetim(URL,path){
	  kelime = URL.kelime.value;
	  if(kelime =='bu kelimeyi ara..') { kelime = ''; }
	  if (URL.grupid.selectedIndex !=-1) { grupid = URL.grupid.options[URL.grupid.selectedIndex].value };
	  if (URL.altgrupid.selectedIndex !=-1) { altgrupid = URL.altgrupid.options[URL.altgrupid.selectedIndex].value };
	  if (URL.markaid.selectedIndex !=-1) { markaid = URL.markaid.options[URL.markaid.selectedIndex].value };

	  yol = '';	
	  if (kelime != '') yol += '&kelime='+kelime;
	  if (grupid != '') yol += '&grupid='+grupid;
	  if (altgrupid != '') yol += '&altgrupid='+altgrupid;
	  if (markaid != '') yol += '&markaid='+markaid;
	  location.href = path + '?search=true'+yol;
	}

	function kelime_arabul(){
	  var URL = document.form_arabul;
	  var arabul_kelime = URL.arabul_kelime.value;
	  var arabul_turu=null;
	  var nereye=null;
	  var arabul_turu=URL.arabul_turu;

	  for(var i=0;i<arabul_turu.length;i++)
		if(arabul_turu[i].checked)
		  nereye=arabul_turu[i].value;

	  if (arabul_kelime != '' && arabul_kelime != 'bu kelimeyi ara..') {
		  if (nereye == '1') location.href = './?module=arabul&kelime='+arabul_kelime;	  
		  else location.href = 'http://www.google.com.tr/search?hl=tr&q='+arabul_kelime;	
	  }
	}

	function windowopen(LinkText){
		window.open(LinkText,'popup_altin','width=630,height=465,status=1,scrollbars=1,resizable=1');
	}

	function sendorder(MID, ElementId){
		if (!(document.getElementById(ElementId).value>0))
		{
			alert('Ürün adedini seçip tekrar deneyiniz.');
			return false;
		}else{
			location.href = './sepetegonder.php?MID=' + MID + '&adet=' + document.getElementById(ElementId).value;
			return true;
		}
	}

	function sendorderpopup(MID, ElementId){
		if (!(document.getElementById(ElementId).value>0))
		{
			alert('Ürün adedini seçip tekrar deneyiniz.');
			return false;
		}else{
			location.href = './sepetegonder.php?MID=' + MID + '&adet=' + document.getElementById(ElementId).value + '&popup=true';
			return true;
		}
	}

	function showhideorder(divsiparis) {
		if (document.getElementById(divsiparis).style.display=="") {
			document.getElementById(divsiparis).style.display="none";
		}else {
			document.getElementById(divsiparis).style.display="";
		}
	}

	/*
	Clock Time In Turkish for Mozilla and IE 4.0+
	info: leventuysal@gmail.com
	09.02.2005
	*/
	function clock(){
		days = new Array('Ocak','Şubat','Mart','Nisan','Mayıs','Haziran','Temmuz','Ağustos','Eylül','Ekim','Kasım','Aralık');
		current = new Date();

		if(current.getSeconds()<10) Seconds = "0"+current.getSeconds();
		else Seconds = current.getSeconds();

		if(current.getMinutes()<10) Minutes = "0"+current.getMinutes();
		else Minutes = current.getMinutes();

		if(current.getHours()<10) Hours = "0"+current.getHours();
		else Hours = current.getHours();

		document.getElementById("saat").innerHTML = '&nbsp;<span class=yazi>'+current.getDate()+' '+days[current.getMonth()]+' '+current.getFullYear()+' '+Hours+':'+Minutes+':'+Seconds+'</span>&nbsp;';
		setTimeout("clock()",1000);
	}

	/*
	Money Formatting Function on Key-Up for YTL (New Turkish Lira) for Mozilla and IE 4.0+
	info: leventuysal@gmail.com
	09.10.2004
	*/

	function FindComma(value){
		var len=value.length-1;
		
		for (i=len;i>=0;i--){
			if(value.charAt(i)== ",") { return i;}
		}
		return 0;
	}

	function NewMoneyFormat(obj) {

		var value=obj.value;
		var len=obj.value.length-1;

		var fstr="";
		var fstr_comma="";

		var zerocount=4; // numbers before comma as 111,xxxx

		var tmp="";
		var comma=0;
		var intlen=0;
		var upperlimit=0;

		comma=FindComma(value);	// finds comma position

		for (i=0;i<=len;i++){
			(
				(
					value.charAt(i).match(/^([0-9])$/) 
					|| (value.charAt(i)== "," && (comma && comma==i))
				)
				&& value.charAt(i)!= "."
			) ? tmp=tmp+value.charAt(i) : NaN;
		}
		comma=FindComma(tmp);	

		if(comma>0) { intlen=comma-1; }
		else { intlen = tmp.length-1; }

		j=0
		for (i=intlen;i>=0;i--){
			j++;
			if ((j % 3)==0 && i>0){
				fstr="." + tmp.charAt(i) + fstr;
				j=0;
			}			
			else
				fstr=tmp.charAt(i) + fstr;
		}

		if (comma>0) {
			upperlimit = comma+zerocount	// upperlimit = len 

			for (i=upperlimit;i>=comma;i--){
				fstr_comma=tmp.charAt(i) + fstr_comma;
			}
		}
		return fstr+fstr_comma;
	}



	function isEmail(str) {
		i=0;
		notvalid=false;
		atcount=0;
		atpos=str.indexOf("@");
		firstdotpos=str.indexOf(".");
		notlast=str.lastIndexOf(".");
		if (firstdotpos < atpos) {
			posdist=atpos-firstdotpos;
		}
		dotpos=str.indexOf(".",atpos+1);
		if ((atpos > 0) && (firstdotpos > 0) && ((dotpos - atpos) > 2) && (dotpos < str.length-3) && (notlast != (str.length-1))) {
			while (i < str.length) {
				charmore=str.charAt(i);
				if (charmore == "@") {
					atcount++;
				}
				if (charmore == ".") {
					charagain=str.charAt(i+1);
					if (charmore == charagain) {
						showselect();
						return false;
					}
				}
				charmore=str.charAt(i);
				i++;
			}     
			if (atcount == 1) notvalid=true;
		} else {
			notvalid=false;
			showselect();
		}
		return notvalid;
	}


	/**
	 * This array is used to remember mark status of rows in browse mode
	 */
	var marked_row = new Array;


	/**
	 * Sets/unsets the pointer and marker in browse mode
	 *
	 * @param   object    the table row
	 * @param   interger  the row number
	 * @param   string    the action calling this script (over, out or click)
	 * @param   string    the default background color
	 * @param   string    the color to use for mouseover
	 * @param   string    the color to use for marking a row
	 *
	 * @return  boolean  whether pointer is set or not
	 */
	function setPointer(theRow, theRowNum, theAction, theDefaultColor, thePointerColor, theMarkColor) {
		var theCells = null;

		// 1. Pointer and mark feature are disabled or the browser can't get the
		//    row -> exits
		if ((thePointerColor == '' && theMarkColor == '')
			|| typeof(theRow.style) == 'undefined') {
			return false;
		}

		// 2. Gets the current row and exits if the browser can't get it
		if (typeof(document.getElementsByTagName) != 'undefined') {
			theCells = theRow.getElementsByTagName('td');
		}
		else if (typeof(theRow.cells) != 'undefined') {
			theCells = theRow.cells;
		}
		else {
			return false;
		}

		// 3. Gets the current color...
		var rowCellsCnt  = theCells.length;
		var domDetect    = null;
		var currentColor = null;
		var newColor     = null;
		// 3.1 ... with DOM compatible browsers except Opera that does not return
		//         valid values with "getAttribute"
		if (typeof(window.opera) == 'undefined'
			&& typeof(theCells[0].getAttribute) != 'undefined') {
			currentColor = theCells[0].getAttribute('bgcolor');
			domDetect    = true;
		}
		// 3.2 ... with other browsers
		else {
			currentColor = theCells[0].style.backgroundColor;
			domDetect    = false;
		} // end 3

		// 4. Defines the new color
		// 4.1 Current color is the default one
		if (currentColor == ''
			|| currentColor.toLowerCase() == theDefaultColor.toLowerCase()) {
			if (theAction == 'over' && thePointerColor != '') {
				newColor              = thePointerColor;
			}
			else if (theAction == 'click' && theMarkColor != '') {
				newColor              = theMarkColor;
				marked_row[theRowNum] = true;
			}
		}
		// 4.1.2 Current color is the pointer one
		else if (currentColor.toLowerCase() == thePointerColor.toLowerCase()
				 && (typeof(marked_row[theRowNum]) == 'undefined' || !marked_row[theRowNum])) {
			if (theAction == 'out') {
				newColor              = theDefaultColor;
			}
			else if (theAction == 'click' && theMarkColor != '') {
				newColor              = theMarkColor;
				marked_row[theRowNum] = true;
			}
		}
		// 4.1.3 Current color is the marker one
		else if (currentColor.toLowerCase() == theMarkColor.toLowerCase()) {
			if (theAction == 'click') {
				newColor              = (thePointerColor != '')
									  ? thePointerColor
									  : theDefaultColor;
				marked_row[theRowNum] = (typeof(marked_row[theRowNum]) == 'undefined' || !marked_row[theRowNum])
									  ? true
									  : null;
			}
		} // end 4

		// 5. Sets the new color...
		if (newColor) {
			var c = null;
			// 5.1 ... with DOM compatible browsers except Opera
			if (domDetect) {
				for (c = 0; c < rowCellsCnt; c++) {
					theCells[c].setAttribute('bgcolor', newColor, 0);
				} // end for
			}
			// 5.2 ... with other browsers
			else {
				for (c = 0; c < rowCellsCnt; c++) {
					theCells[c].style.backgroundColor = newColor;
				}
			}
		} // end 5

		return true;
	} // end of the 'setPointer()' function



	function CreateSelectItem(selectctrl, itemArray, itemArrayAll, defaultItem, maxItem, goodPrompt, badPrompt) {
		var i, j;
		var prompt;
		for (i = selectctrl.options.length; i >= 0; i--) {
			selectctrl.options[i] = null; 
		}
		prompt = (itemArray != null) ? goodPrompt : badPrompt;
		if (prompt == null) {
			j = 0;
		}
		else {
			selectctrl.options[0] = new Option(prompt);
			j = 1;
		}
		if (itemArray != null) {
			for (i = 0; i < itemArray.length; i++) {
				selectctrl.options[j] = new Option(itemArray[i][0]);
				if (defaultItem ==null && i==0)
				{
					selectctrl.options[j].selected = true;
				}
				if (itemArray[i][1] != null) {
					selectctrl.options[j].value = itemArray[i][1]; 
					if (itemArray[i][1] ==defaultItem)
					{
						selectctrl.options[j].selected = true;
					}
				}
				j++;
			}			
	   }
	   else {
			selectctrl.options[j] = new Option(' [ Hepsi ] ');
			selectctrl.options[j].value = ''; 
			selectctrl.options[j].selected = true;
			j++;
			if (itemArrayAll.length>maxItem) {
				for (k = 0; k < itemArrayAll.length; k++) {
					for (i = 0; i < itemArrayAll[k].length; i++) {
						if (itemArrayAll[k][i][1] != null && itemArrayAll[k][i][1] != '') {
							selectctrl.options[j] = new Option(itemArrayAll[k][i][0]);
							selectctrl.options[j].value = itemArrayAll[k][i][1]; 
							j++;
						}
					}
				}
			}
	   }
	}

	function PreloadImages() { 
		if (document.images) { 
			var imgFiles = PreloadImages.arguments; 
			var preloadArray = new Array();
			for (var i=0; i<imgFiles.length; i++) { 
				preloadArray[i] = new Image; 
				preloadArray[i].src = IMGPath + imgFiles[i] + ".gif"; 
			} 
		} 
	} 





	// Select From To Other
	var NS4 = (navigator.appName == "Netscape" && parseInt(navigator.appVersion) < 5);

	function addOption(theSel, theText, theValue)
	{
	  var newOpt = new Option(theText, theValue);
	  var selLength = theSel.length;
	  theSel.options[selLength] = newOpt;
	}

	function deleteOption(theSel, theIndex)
	{ 
	  var selLength = theSel.length;
	  if(selLength>0)
	  {
		theSel.options[theIndex] = null;
	  }
	}

	function moveOptions(theSelFrom, theSelTo, theHiddenSelTo)
	{
	  
	  var selLength = theSelFrom.length;
	  var selectedText = new Array();
	  var selectedValues = new Array();
	  var selectedCount = 0;
	  
	  var i;
	  
	  // Find the selected Options in reverse order
	  // and delete them from the 'from' Select.
	  for(i=selLength-1; i>=0; i--)
	  {
		if(theSelFrom.options[i].selected)
		{
		  selectedText[selectedCount] = theSelFrom.options[i].text;
		  selectedValues[selectedCount] = theSelFrom.options[i].value;
		  deleteOption(theSelFrom, i);
		  selectedCount++;

		}
	  }
	  
	  // Add the selected text/values in reverse order.
	  // This will add the Options to the 'to' Select
	  // in the same order as they were in the 'from' Select.
	  for(i=selectedCount-1; i>=0; i--)
	  {
		addOption(theSelTo, selectedText[i], selectedValues[i]);
	  }
	  
	  if(NS4) history.go(0);
	}

	function FillIDValues(theSelOpt, theHiddenText)
	{
	  var i;
	  bayiid_value = '';

	  for(i=theSelOpt.length-1; i>=0; i--)
	  {
		 bayiid_value = bayiid_value + ',' + theSelOpt.options[i].value;
	  }
	  theHiddenText.value = bayiid_value;

	}
	// ..
