
	var isSelectedDelete = false;
	var strCheckedItem = ""
	function CheckBoxControl(cName,tableName,hiColor,rowNo){
		if(cName.checked==true){
			document.getElementById(tableName).rows[rowNo].style.backgroundColor=hiColor
			strCheckedItem = strCheckedItem + "," + rowNo + ","
		}else{
			document.getElementById(tableName).rows[rowNo].style.backgroundColor="#FFFFFF"
			strCheckedItem = strCheckedItem.replace("," + rowNo + ",","")
		}
		
		if(strCheckedItem==""){
			isSelectedDelete = false
		}else{
			isSelectedDelete = true
		}
	}
	
	function selectAllCheckBox(obj){
		var oCheckbox = document.getElementsByName("chkbox01")
		for(var i=0;i<oCheckbox.length;i++){
			if(!oCheckbox[i].disabled){
				if(obj.checked){
					isSelectedDelete = true
					oCheckbox[i].checked=true
				}else{
					oCheckbox[i].checked=false
				}
			}
		}
	}
	
	function deleteSelectedRecord(url){
		if(isSelectedDelete){
			if(confirm("Seçili kayıtları silmek istediğinize eminmisiniz?")){
				document.frmList.action = url;
				document.frmList.submit();
			}
		}else{
			alert("Öncelikle seçim yapmalısınız")
		}
	}
	
	function processSelectedRecord(url,confirmText){
		if(isSelectedDelete){
			if(confirm(confirmText)){
				document.frmList.action = url;
				document.frmList.submit();
			}
		}else{
			alert("Öncelikle seçim yapmalısınız")
		}
	}
	
	function deleteRecord(url){
		if(confirm("Kaydı silmek istediğinize eminmisiniz?")){
			window.location.href=url
		}
	}
	
	function ComboAutoSelected(objDropDown,selectedValue){
		for (i=0;i<=objDropDown.length-1;i++){
			if (objDropDown.options[i].value == selectedValue){
				objDropDown.selectedIndex = i ;
			}
		}	
	}
	
	
	function CheckboxAutoSelected(objCheckBox,objValue){
		//var aryobjValue = objValue.split(",")
//
//		for(var j=0;j<=aryobjValue.length-1;j++){
//			for (i=0;i<=objCheckBox.length-1;i++){
//				if (objCheckBox[i].value == aryobjValue[j]){
//					objCheckBox[i].checked=true; ;
//				}
//			}
//		}
		
		for (i=0;i<=objCheckBox.length-1;i++){
			if (objValue.indexOf(objCheckBox[i].value)>-1){
				objCheckBox[i].checked=true; ;
			}
		}
	}
	


	function showHideShoppingCardIFrame(isShoppingCard,IsRefresh,strImage){
		var location
		
		try{
			if(window.parent.document.getElementById('ifrmShoppingCard')){
				location = window.parent
			}else if(window.opener.document.getElementById('ifrmShoppingCard')){
				location = window.opener
			}
		}catch(e){
		
		}
		if(location){
			if(isShoppingCard){
				location.document.getElementById('ifrmShoppingCard').height = document.getElementById("oTblShoppingCard").offsetHeight
				location.document.getElementById('btnTeklifGonder').src = "files/images/btn-" + strImage + "-tamamla.png"
				location.document.getElementById('btnTeklifGonder').onclick = function newFN(){location.validation();}
				location.document.getElementById('btnTeklifGonder').style.cursor = "pointer"
				if(IsRefresh){
					location.document.getElementById('ifrmShoppingCard').src = location.document.getElementById('ifrmShoppingCard').src
				}
			}else{
				location.document.getElementById('ifrmShoppingCard').height="0px"
				location.document.getElementById('btnTeklifGonder').src = "files/images/btn-" + strImage + "-tamamla-disabled.png"
				location.document.getElementById('btnTeklifGonder').onclick="";
				location.document.getElementById('btnTeklifGonder').style.cursor = "default"
			}
		}
	}
	
	function setValueIsnetObject(objName,objValue){
		var wiInputObject = ISGetObject(objName);
 		wiInputObject.SetValueData(objValue);
		
		document.getElementById("hd_"+objName).value = objValue

	}
	
	function sendData(url,isRefresh,isReturn){
		    oxmlhttp = null;
		    try{ 
			    oxmlhttp = new XMLHttpRequest();
			    oxmlhttp.overrideMimeType("text/xml");
		    }catch(e){ 
			    try{ 
				    oxmlhttp = new ActiveXObject("Msxml2.XMLHTTP");
			    }catch(e){ 
		            return null;
		        }
		    }
    		
		    if(!oxmlhttp) {return null;}
    		
	        try{
		        oxmlhttp.open("GET",url,false);
		        oxmlhttp.send(null);
    			
		        if(isReturn && oxmlhttp.responseText.length>0){
			        return oxmlhttp.responseText;				
		        }
    			
		        if(isRefresh){
			        window.location.reload();
		        }
	        }catch(e){ return null;}
    	    
	    }
	
	
	function changeState(obj,state){	
		if (state == 'h'){
			obj.style.backgroundPosition = "0px -24px";	
		} else if (state == 'd'){
			obj.style.backgroundPosition = "0px -48px";	
		} else if (state == 'o'){
			obj.style.backgroundPosition = "0px 0px";	
		}
	} 
	 
	function formatText(action){
		var textarea = document.getElementById('TextBody');
		textarea.focus();
		
		// get selection in firefox, opera, ...
	 
		if (typeof(textarea.selectionStart) == 'number')
	 
		{	alert(textarea.selectionStart);
			
		}else if(document.selection){
			var selection_range = document.selection.createRange().duplicate();
	 
			if (selection_range.parentElement() == textarea) {    // Check that the selection is actually in our textarea
			// Create three ranges, one containing all the text before the selection,
			// one containing all the text in the selection (this already exists), and one containing all
			// the text after the selection.
			var before_range = document.body.createTextRange();
			before_range.moveToElementText(textarea);                    // Selects all the text
			before_range.setEndPoint("EndToStart", selection_range);     // Moves the end where we need it
	 
			var after_range = document.body.createTextRange();
			after_range.moveToElementText(textarea);                     // Selects all the text
			after_range.setEndPoint("StartToEnd", selection_range);      // Moves the start where we need it
	 
			var before_finished = false, selection_finished = false, after_finished = false;
			var before_text, untrimmed_before_text, selection_text, untrimmed_selection_text, after_text, untrimmed_after_text;
	 
			// Load the text values we need to compare
			before_text = untrimmed_before_text = before_range.text;
			selection_text = untrimmed_selection_text = selection_range.text;
			after_text = untrimmed_after_text = after_range.text;
	 
			// Check each range for trimmed newlines by shrinking the range by 1 character and seeing
			// if the text property has changed.  If it has not changed then we know that IE has trimmed
			// a \r\n from the end.
			do {
			  if (!before_finished) {
				  if (before_range.compareEndPoints("StartToEnd", before_range) == 0) {
					  before_finished = true;
				  } else {
					  before_range.moveEnd("character", -1)
					  if (before_range.text == before_text) {
						  untrimmed_before_text += "\r\n";
					  } else {
						  before_finished = true;
					  }
				  }
			  }
			  if (!selection_finished) {
				  if (selection_range.compareEndPoints("StartToEnd", selection_range) == 0) {
					  selection_finished = true;
				  } else {
					  selection_range.moveEnd("character", -1)
					  if (selection_range.text == selection_text) {
						  untrimmed_selection_text += "\r\n";
					  } else {
						  selection_finished = true;
					  }
				  }
			  }
			  if (!after_finished) {
				  if (after_range.compareEndPoints("StartToEnd", after_range) == 0) {
					  after_finished = true;
				  } else {
					  after_range.moveEnd("character", -1)
					  if (after_range.text == after_text) {
						  untrimmed_after_text += "\r\n";
					  } else {
						  after_finished = true;
					  }
				  }
			  }
	 
			} while ((!before_finished || !selection_finished || !after_finished));
	 
			// Untrimmed success test to make sure our results match what is actually in the textarea
			// This can be removed once you're confident it's working correctly
			var untrimmed_text = untrimmed_before_text + untrimmed_selection_text + untrimmed_after_text;
			var untrimmed_successful = false;
			if (textarea.value == untrimmed_text) {
			  untrimmed_successful = true;
			}
			// ** END Untrimmed success test
	 
			var startPoint = untrimmed_before_text.length;
			textarea.value = before_text + '[' + action + ']' + selection_text + '[/' + action + ']' + untrimmed_after_text;
			countDownText();
			}
		}
	}
	
	function IsNumberic(v) {
		var isNum = /^[0-9]*$/;
		if (!isNum.test(v)){
			return false;
		}else{
			return true;	
		}
	}
	
	function checkPoint(minVal,maxVal,obj){
		var objVal = obj.value
		
		if(objVal!=""){
			if(IsNumberic(objVal)){
				if(objVal<minVal){
					alert("Minimum point must be " + minVal)
					obj.value = minVal
				}else if(objVal>maxVal){
					alert("Maximum point must be " + maxVal)
					obj.value = maxVal
				}
			}else{
				alert("Only numeric value")
				obj.value = ""
			}
		}
	}

