function edoptions(name,sel1,sel2,sel3)
{
	var drdwn= document.getElementById(sel1);
	var drdwn2= document.getElementById(sel2);
	var drdwn3= document.getElementById(sel3);
	var dropdownIndex = document.getElementById(name).selectedIndex;
	var dropdownValue = document.getElementById(name)[dropdownIndex].value;
	
	if(dropdownValue == 1)
	{
		drdwn.disabled=false;  
		drdwn2.disabled=false;
		drdwn3.disabled=false;
	}
	else
	{
		
		drdwn.disabled=true;
		drdwn2.disabled=true;
		drdwn3.disabled=true;
	
	}
	
}

function browse_page(page,fname,action,divid)
{
	 if(fname !='')
	 {
		var formvalues = do_it(fname);
		if(formvalues !='hata')
		{
		 var url=page+formvalues+'action='+action+'&';
		 makerequest_s(url, divid, '');
		 return;  
		}
	 }
	 else
	 {
		 var url=page+'action='+action+'&';
		 makerequest_s(url, divid, ''); 
		 return;
	 }
	
}


function FilterInput(filterType, evt, allowDecimal, allowCustom)
{
	 var keyCode, Char, inputField, filter = '';
	 var alpha = 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ';
	 var num   = '0123456789';

	 // Get the Key Code of the Key pressed if possible else - allow
	 if(window.event) {keyCode = window.event.keyCode; evt = window.event;} else if(evt) {keyCode = evt.which;} else {return true;}

	 // Setup the allowed Character Set
	 if(filterType == 0) {filter = alpha;} else if(filterType == 1) {filter = num;} else if(filterType == 2) {filter = alpha + num;}
	 if(allowCustom) {filter += allowCustom;}
	 if(filter == '') {return true;}

	 // Get the Element that triggered the Event
	 inputField = evt.srcElement ? evt.srcElement : evt.target || evt.currentTarget;

	 // If the Key Pressed is a CTRL key like Esc, Enter etc - allow
	 if((keyCode==null) || (keyCode==0) || (keyCode==8) || (keyCode==9) || (keyCode==13) || (keyCode==27)) {return true;}

	 // Get the Pressed Character
	 Char = String.fromCharCode(keyCode);

	 // If the Character is a number - allow
	 if((filter.indexOf(Char) > -1)) {return true;} else if(filterType == 1 && allowDecimal && (Char == '.') && inputField.value.indexOf('.') == -1) {return true;} else {return false;}
}


function satirrenk_click(id)
{
  var trobj = document.getElementById(id);
  
  if(satirid !='')
	{
	 var trobj1=document.getElementById(satirid);
	 trobj1.bgColor = '#ffffff';  
	}
	   trobj.bgColor = '#FEE9C0';
	   satirid=id;  
}


function satirrenk (id)
{
 // alert(satirid+'  '+id);return;
	if(satirid ==id)
	{
	return;
	}
	else
	{
	var trobj = document.getElementById(id);
	if (trobj.bgColor == '#ffffff')
	   {
		trobj.bgColor = '#bbd863';
	   }
	else
	   {
		trobj.bgColor = '#ffffff';
	   }
	}
}


function rowcolor(id)
{
 // alert(satirid+'  '+id);return;
   
	var trobj = document.getElementById(id);
	if (trobj.bgColor == '#eeeeee')
	   {
		trobj.bgColor = '#bbd863';
	   }
	else
	   {
		trobj.bgColor = '#eeeeee';
	   }
	
}
function bring_page(page,name,divname,action)
{
 satirid='';
 var dropdownIndex = document.getElementById(name).selectedIndex;
 var dropdownValue = document.getElementById(name)[dropdownIndex].value;
 var url=page;
 var params='&action='+action+'&'+'counter='+dropdownValue+'&';
 //alert(params);return;
 makerequest_sp(url, params, divname);
 //makerequest_s(url, divname, '');
//alert(dropdownValue);return;
}

function bring_page_userdetails(page,divname,action)
{
 satirid='';
 var url=page+'&action='+action+'&';
 makerequest_s(url, divname, '');
 
//alert(dropdownValue);return;

}

function chCheckRadio_id(oRadio,msg) {
	  var or = document.getElementsByName(oRadio);
	  var id=999999999;
	  var uid=0;
	  for (var i = 0; i < or.length; i++) {
		 if(or[i].checked == true)
		 {
		   id=i;
		   uid=or[i].value;
		 }
	  }
	 // alert(id); 
	  if(id==999999999)
	  {
		alert(msg);
	  }
	  uid=uid.split('#');
	  return uid[0];
}


function chCheckRadio(oRadio,msg) {
	  var or = document.getElementsByName(oRadio);
	  var id=999999999;
	  var uid=0;
	  for (var i = 0; i < or.length; i++) {
		 if(or[i].checked == true)
		 {
		   id=i;
		   uid=or[i].value;
		 }
	  }
	 // alert(id); 
	  if(id==999999999)
	  {
		alert(msg);
	 
	  }
	  return id;
}

function make_order_page_mine(oRadio,msg,formid,my_id,page,action,msg2)
{
  var dataid = chCheckRadio_id(oRadio,msg);
  //alert(my_id);return;
  if(dataid != 999999999)
  {
	 if(dataid==my_id)
	 {
	   alert(msg2);
	   return;
	 }
	 else
	 {
	   var formvalues = do_it(formid);
	   if(formvalues!='hata')
	   {
		   if (!document.getElementById('foo'))
			 create_foo(150,330);
			 
			 var url=page+formvalues+'&action='+action+'&';
			 makerequest_s(url, 'foo', ''); 
			 return;  
		
	   }
	 }
  }
}

function make_order_page(oRadio,msg,formid,divid,page,action)
{

  var dataid = chCheckRadio(oRadio,msg);
  if(dataid != 999999999)
  {
	 var formvalues = do_it(formid); 
	 if(formvalues!='hata')
	 {
	   
		if(divid=='')
		{
		
		
		   if (!document.getElementById('foo'))
			 //alert();
			 create_foo(150,330);
			 var url=page+formvalues+'&action='+action+'&';
			 makerequest_s(url, 'foo', ''); 
			 return;  
		}
		else
		{
			 
			 var url=page+formvalues+'action='+action+'&';
			 //alert(url);return;
			 makerequest_s(url, divid, '');  
		
		}
		
	 }
  }

}


function make_order_page2(oRadio,msg,formid,divid,page,action)
{

  var dataid = chCheckRadio(oRadio,msg);
  if(dataid != 999999999)
  {
	 var formvalues = do_it(formid); 
	 if(formvalues!='hata')
	 {
	   
		if(divid=='')
		{
		
		
		   if (!document.getElementById('foo'))
			 //alert();
			 create_foo(410,330);
			 var url=page+formvalues+'&action='+action+'&';
			 makerequest_s(url, 'foo', ''); 
			 return;  
		}
		else
		{
			 
			 var url=page+formvalues+'action='+action+'&';
			 makerequest_s(url, divid, '');  
		
		}
		
	 }
  }

}


function popup_show(id, position, x, y, position_id)
{ 
  //alert('drag'+drag_id);
  var element      = document.getElementById(id);
  var width        = window.innerWidth  ? window.innerWidth  : document.documentElement.clientWidth;
  var height       = window.innerHeight ? window.innerHeight : document.documentElement.clientHeight;
  
  element.style.position = "absolute";
  element.style.display  = "block";

  if (position == "element" || position == "element-right" || position == "element-bottom")
  {
	var position_element = document.getElementById(position_id);

	for (var p = position_element; p; p = p.offsetParent)
	  if (p.style.position != 'absolute')
	  {
		x += p.offsetLeft;
		y += p.offsetTop;
	  }

	if (position == "element-right" ) x += position_element.clientWidth;
	if (position == "element-bottom") y += position_element.clientHeight;

	element.style.left = x+'px';
	element.style.top  = y+'px';
  }

  if (position == "mouse")
  {
	element.style.left = (document.documentElement.scrollLeft+popup_mouseposX+x)+'px';
	element.style.top  = (document.documentElement.scrollTop +popup_mouseposY+y)+'px';
  }

  if (position == "screen-top-left")
  {
	element.style.left = (document.documentElement.scrollLeft+x)+'px';
	element.style.top  = (document.documentElement.scrollTop +y)+'px';
  }

  if (position == "screen-center")
  {
	element.style.left = (document.documentElement.scrollLeft+(width -element.clientWidth )/2+x)+'px';
	element.style.top  = (document.documentElement.scrollTop +(height-element.clientHeight)/2+y)+'px';
  }

}


function create_foo (ust,sol)
{

	var width_cont = document.body.scrollLeft;
	var height_cont = document.body.scrollTop;
	var padding_left = (width_cont/2) - 25;
	var padding_top = height_cont/2-25;
	var buyuk_div = document.createElement('DIV');
	buyuk_div.id = 'buyuk';
	buyuk_div.style.width = width_cont+"px";
	buyuk_div.style.height = height_cont+"px";
	buyuk_div.style.position = 'absolute';
	buyuk_div.style.left = (0)+"px";
	buyuk_div.style.top = (0)+"px";
	buyuk_div.style.bgcolor = '#EEEEEE';
	window.document.body.appendChild(buyuk_div);

	var div = document.createElement('DIV');
	div.id = 'foo';
	div.style.width='60%'; 
	div.style.MOZwidth='60%';
	//div.style.height = '250';
	div.style.position = 'absolute';

	 div.style.left = sol+"px";
	div.style.top = ust+"px";
   
	
	div.style.zIndex=90;
	div.style.color="#000000";
	
	document.body.appendChild(div);             
	
	
	popup_show('foo', 'screen-center',0,-120);
	
	
			 
	/*center of browser */
	/*
	var element      = div;
	var width        = window.innerWidth  ? window.innerWidth  : document.documentElement.clientWidth;
	var height       = window.innerHeight ? window.innerHeight : document.documentElement.clientHeight;
	
	element.style.position = "absolute";
	element.style.display  = "block";
	
	
	var x =-600;
	var y= 0;
	element.style.left = (document.documentElement.scrollLeft+(width -element.clientWidth )/2+x)+'px';
	element.style.top  = (document.documentElement.scrollTop +(height-element.clientHeight)/2+y)+'px';
	 */
   
	//div.style.border = '1px solid #000000';
	
  /*  var object = document.getElementById('foo').style; 
	object.opacity = 1; 
	object.MozOpacity = 1; 
	object.KhtmlOpacity = 1; 
	object.filter = "alpha(opacity=1)";
	opacity('foo', 1, 100, 500);*/
}





function delete_foo()
{
  //  opacity('foo', 80, 0, 500);
	  var div = document.getElementById('foo');
				var buyuk_div =  document.getElementById('buyuk');
				document.body.removeChild(div);
				document.body.removeChild(buyuk_div);
}

function change_divheight(divid,height_cont,height)
{
  var div=document.getElementById(divid);
  div.style.height = height_cont+"px";  
}

function addseps(x) {

//make x a new variable

var x=x;

//make x a string

x+="";

//or x=String(x);

//iLen is the number of digits before any decimal point

// for 45.123, iLen is 2

//iLen is the length of the number, if no decimals

iLen=x.length;

pos=x.indexOf(".");

if (pos>-1) //there are decimals

{

iLen=pos;

}

//add the decimal point

temp="";

//add the decimal part to begin

// with 45.123, we add the .123

temp=x.substring(iLen,x.length);

//iLen-1 is the rightmost non-decimal digit (5 in 98745.123)

for (var i=iLen-1;i>=0;i--)

//we add a separator when the expression (iLen-i-1)%3==0 is true...

//except when i is (iLen-1), or the first digit

//eg (98745.12). i is iLen-1, and the digit pos is next the decimal, 

//it is 5. From here, we decrement i...iLen-2, iLen-3, iLen-4 ... when i is a multiple of

//3, (i=iLen-iLen+4-1). This point is just before the number 7

if ((iLen-i-1)%3==0&&i!=iLen-1)

temp=x.charAt(i)+","+temp;

else

temp=x.charAt(i)+temp;

return temp;

}//end of addseps(x)






function calculate_discount(orqty,price,term)
{

 //alert(addseps(10000123.99));
 //return;


  var Orderqty=document.getElementById(orqty).value;
  var Price=document.getElementById(price).value; 
  
  //Orderqty=50000000;
  //Price=12.541;
  //term=28;
  Price = Price / 100;
  var one=1; 
 // alert(Orderqty+'-'+Price+'-'+term);
  var disc= Orderqty/(one+Price*term/360);
   //alert(1+0.12541*28/360);
   
  //alert(50000000/(1+0.12541*28/360));      
  var s=document.getElementById('discount').innerHTML= addseps(Math.round(disc));
  
  calculate_interest(Orderqty,disc);
   return;
}
function calculate_interest(qty,disc)
{
	//alert();
   var s=document.getElementById('interest').innerHTML= addseps(Math.round(qty-disc));
   return;
}

function do_transactions_page(page1,page2,formid,divid1,divid2,action1,action2)
{

  satirid=''; 
	var formvalues = do_it(formid);
	//alert(formvalues+'PAGE='+page1);   return;
	if(formvalues != 'hata')
	{
		i=0;
		ndx=3;
		obj[2]=divid1;
		obj[1]=divid2;
		obj[0]=divid1;
		sPage[2]=page1+'action=list&';
		sPage[1]=page2+'action='+action2+'&';
		sPage[0]=page1+'action='+action1+'&'+formvalues;
	   // sPage[0]=page1+'action=list&';
		//alert(sPage);
		makerequest("");
		
	   //var b=init_body2(); 
		
		delete_foo();
	  
	}
	  return;

}

function do_transactions_page_foo(page1,page2,formid,divid1,divid2,action1,action2)
{

	satirid=''; 
	var formvalues = do_it(formid);
	//alert(formvalues+'PAGE='+page1);   return;
	if(formvalues != 'hata')
	{
		i=0;
		ndx=2;
		//obj[2]=divid1;
		obj[1]=divid2;
		obj[0]=divid1;
		//sPage[2]=page1+'action=list&';
		sPage[1]=page2+'action='+action2+'&';
		sPage[0]=page1+'action='+action1+'&'+formvalues;
	   // sPage[0]=page1+'action=list&';
		//alert(sPage);
		makerequest("");
		
	   //var b=init_body2(); 
		
		delete_foo();
	  
	}
	  return;

}


function do_core_transactions(page1,action1,div1,page2,action2,div2,formid)
{
  satirid=''; 
   if(formid !='')
   {
		var formvalues = do_it(formid);
		if(formvalues!='hata')
		{
		//alert(formvalues);return;
		i=0;
		ndx=2;
		//obj[2]=div1;
		obj[0]=div2;
		obj[1]=div1;
	   // sPage[2]=page1+'action=list&';
		sPage[0]=page2+'action='+action2+'&'+formvalues;
		sPage[1]=page1+'action='+action1+'&';
	   // sPage[0]=page1+'action=list&';
		//alert(sPage);
		
		makerequest("");
		return;
		}
	  
   }
   else
   {    
		//alert('div2'+div2+'-page2='+page2+'-action2='+action2);return;
		i=0;
		ndx=2;
		//obj[2]=div3;
		obj[1]=div2;
		obj[0]=div1;
		//sPage[2]=page3+'action='+action3+'&';
		sPage[1]=page2+'action='+action2+'&';
		sPage[0]=page1+'action='+action1+'&';
	   // sPage[0]=page1+'action=list&';
		//alert(sPage);
		makerequest("");

   }
  
}
function do_one_page(page,divid,formid)
{
   if(formid !='')
   {
	var formvalues = do_it(formid); 
	//alert(formvalues);return;
	if(formvalues != 'hata')
	{
	  url=page+formvalues;

	  makerequest_s(url, divid, '');
	}
   }
   else
   { 
	  satirid=''; 
	  //var s=document.getElementById('table1').innerHTML= ''; 
	  url=page;
	  //alert(url);
	  makerequest_s(url, divid, '');
   } 
}


function check_if_exist(serverPage,objID, formid,page1,action1,div1)
{         
   if(formid !='')
   {
	var formvalues = do_it(formid);
	if(formvalues != 'hata')
	{
	  
	  var url=serverPage+formvalues;
	  makerequest_ch(url,objID, formid,page1,action1,div1);
	}
   }
}

function check_if_exist2(serverPage,objID, formid,page1,action1,div1,page2,action2,div2)
{         
  if(formid !='')
   {
	var formvalues = do_it(formid);

	if(formvalues != 'hata')
	{
	  
	  var url=serverPage+formvalues;
	  makerequest_ch(url,objID, formid,page1,action1,div1,page2,action2,div2);
	  return;
	}
   }
}


function check_sid(oRadio)
{
  
   var or = document.getElementsByName(oRadio);  
   var logic=false;
   //var sid_array=sid.split('#');
   for (var i = 0; i < or.length; i++) {
		 if(or[i].checked == true)
		 {
		   id=i;
		   uid=or[i].value;
		 }
	  }
	
	  
   uid=uid.split('#'); 
   if(uid[0]==1)
   {
	  logic=true;
   }
   else
   {                                   
	 logic=false;
   }
  //alert(logic);return;
   return logic;
}

function make_order_page_pending(oRadio,msg,formid,page,action,msg2,sid)
{
  
  //return;
  //alert(sid);return;
  var dataid = chCheckRadio(oRadio,msg);
  if(dataid != 999999999)
  {
   if(check_sid(oRadio))
   {
	   var formvalues = do_it(formid);
	   if(formvalues!='hata')
	   {
		   if (!document.getElementById('foo'))
			 create_foo(300,300);
			 
			 var url=page+formvalues+'&action='+action+'&';
			 makerequest_s(url, 'foo', ''); 
			 return;  
		
	   }
   }
   else
   {
	alert(msg2);
	return;
   }
  }
}

function do_transactions_page2(page1,page2,formid,divid1,divid2,action1,action2)
{

	satirid=''; 
	var formvalues = do_it(formid);
	//alert(formvalues+'PAGE='+page1);   return;
	if(formvalues != 'hata')
	{
		i=0;
		ndx=2;
		//obj[2]=divid1;
		obj[1]=divid2;
		obj[0]=divid1;
		//sPage[2]=page1+'action='+action3+'&';
		sPage[1]=page2+'action='+action2+'&';
		sPage[0]=page1+'action='+action1+'&'+formvalues;
	   // sPage[0]=page1+'action=list&';
		//alert(sPage);
		makerequest("");
	  
	}
	  return;

}
function maxorqty(maxqty)
{ 
	maxamount=maxqty;
}
function forgot_password()
{
	create_foo(150,470);
	makerequest_s('php/login2.php?action=new_password&','foo','');
}
function password_order(fname)
{
	var formvalues=do_it(fname);
	if(formvalues !='hata')
	{
	makerequest_s('php/login2.php'+formvalues+'&action=password_order','foo','');
	}
}
function  load_page_post(page,formid,action,divid)
{
 var formvalues="";
 if(formid!='')
 {
  formvalues = do_it(formid);
  formvalues=formvalues.substring(1,formvalues.length);  
 }else
 {
  formvalues="";
 }
 // var formvalues=do_it('rev_form');
 var url=page;
 var params=formvalues+'action='+action+'&'
 //alert(divid);return;
 makerequest_sp(url, params, divid);
 // makerequest_s(url, 'mytest', ''); 
 //alert(formvalues);return;
}
function popWindow(mypage){

	if( typeof( window.innerWidth ) == 'number' ) {
	//Non-IE
	myWidth = window.innerWidth;
	myHeight = window.innerHeight;
  } else if( document.documentElement && ( document.documentElement.clientWidth || document.documentElement.clientHeight ) ) {
	//IE 6+ in 'standards compliant mode'
	myWidth = document.documentElement.clientWidth;
	myHeight = document.documentElement.clientHeight;
  } else if( document.body && ( document.body.clientWidth || document.body.clientHeight ) ) {
	//IE 4 compatible
	myWidth = document.body.clientWidth;
	myHeight = document.body.clientHeight;
  }

	myWidth -= 200;

	var property = 'width = ' + myWidth + ', height = ' + myHeight + ', toolbar=no, resizable=yes';
	var yeni = parent.window.open(mypage, 'belge', property);
	if (window.focus)
	{
		yeni.focus();
	}
}


function add_province (slctbx1, slctbx2, drctn)
{
	if (drctn == '1')
	{
		var slct1 =  document.getElementById(slctbx1);
		var slct2 =  document.getElementById(slctbx2);
	}
	else if (drctn == '2')
	{
		var slct1 =  document.getElementById(slctbx2);
		var slct2 =  document.getElementById(slctbx1);
	}

	var value = slct1.options[slct1.selectedIndex].value;
	var text = slct1.options[slct1.selectedIndex].text;

	/// ekleme
	var yeni = document.createElement("option");
	yeni.value = value;
	yeni.text = text;
	yeni.selected = 'selected';

	if (slct2.options[0].text == 'No Project Type')
	{
		slct2.removeChild(slct2.options[0]);
		slct2.options.add(yeni);
		slct2.options[0].selected = 'selected';
	}
	else if (slct2.options[0].text != 'No Project Type' && slct1.options[0].text != 'No Project Type')
		slct2.options.add(yeni);

	///silme                                                              
	slct1.removeChild(slct1.options[slct1.selectedIndex]);
	if (slct1.options.length == 0)
	{
		var yeni = document.createElement("option");
		yeni.value = '0';
		yeni.text = 'No Project Type';
		slct1.options.add(yeni);
		slct1.options[0].selected = 'selected';
	}
	else
	{
		slct1.options[0].selected = "selected";
	}
}
function SelectAll(combo)
 {
 
  var selectbox = document.getElementById(combo);
  
   for (var i=0;i<selectbox.options.length;i++)
	{
	  selectbox.options[i].selected=true;
	}
 }
 
function do_one_page2(page,divid,formid)
{
   if(formid !='')
   {
	var formvalues = do_it(formid); 
	//alert(formvalues);return;
	if(formvalues != 'hata')
	{
	  var str=provinces_sel('SubCat');
	  url=page+formvalues+str;
	  makerequest_s(url, divid, '');
	}
   }
   else
   { 
	  satirid=''; 
	  //var s=document.getElementById('table1').innerHTML= ''; 
	  url=page;
	  makerequest_s(url, divid, '');
   } 
}
function provinces_sel (slctbx)
{
	var selectbox = document.getElementById(slctbx);
	var str = 'lengthprovinces='+selectbox.options.length;
	for (var i = 0; i < selectbox.options.length; i++)
	{
		  str += '&'+'province'+i+'='+selectbox.options[i].value;
	}        
	return str;
}
function show_search_advance(divid1,divid2,which)
{
   satirid='';
   if(which==1)
   { 
	var dd1=document.getElementById(divid1);
	//alert(dd1);
	dd1.style.display="none";
	
	var dd2=document.getElementById(divid2);
	dd2.style.display="block";
   }
   else
   {
	 
	var dd2=document.getElementById(divid2);
	dd2.style.display="none";
	
	var dd1=document.getElementById(divid1);
	//alert(dd1);
	dd1.style.display="block";
   }
}

function do_one_page3(page,divid,formid)
{
   if(formid !='')
   {
	var formvalues = do_it(formid); 
	//alert(formvalues);return;
	if(formvalues != 'hata')
	{
	  formvalues=formvalues.substr(1,formvalues.length);
	  url=page+formvalues;
	  //alert(url);return;
	  makerequest_s(url, divid, '');
	}
   }
   else
   { 
	  satirid=''; 
	  //var s=document.getElementById('table1').innerHTML= ''; 
	  url=page;
	  makerequest_s(url, divid, '');
   } 
}


function popWindow(mypage){

	if( typeof( window.innerWidth ) == 'number' ) {
	//Non-IE
	myWidth = window.innerWidth;
	myHeight = window.innerHeight;
  } else if( document.documentElement && ( document.documentElement.clientWidth || document.documentElement.clientHeight ) ) {
	//IE 6+ in 'standards compliant mode'
	myWidth = document.documentElement.clientWidth;
	myHeight = document.documentElement.clientHeight;
  } else if( document.body && ( document.body.clientWidth || document.body.clientHeight ) ) {
	//IE 4 compatible
	myWidth = document.body.clientWidth;
	myHeight = document.body.clientHeight;
  }

	myWidth -= 200;

	var property = 'width = ' + myWidth + ', height = ' + myHeight+50 + ', toolbar=no, scrollbars=yes, resizable=yes';
	var naw = window.open(mypage, 'document', property);
	if (window.focus)
	{
		naw.focus();
	}
}
function show_activity(selector,divid)
{
   var dropdownIndex = document.getElementById(selector).selectedIndex;
   var dropdownValue = document.getElementById(selector)[dropdownIndex].value;
   var dd1=document.getElementById(divid);
   if(dropdownValue=='10')
   {
	 dd1.style.display="block";
   }
   else
   {
	 dd1.style.display="none"; 
   }
   
}
function  load_page(page,divid,action)
{
  satirid='';
  //var s2=document.getElementById('maincontent').innerHTML= ''; 
  var s3=document.getElementById('panel2').innerHTML= ''; 

  url=page;
  var params='action='+action+'&';
  //alert(params);return;
  makerequest_sp(url, params, divid);
}

function load_page_radio(oRadio,msg,formid,divid,page,action)
{
  satirid='';
  var dataid = chCheckRadio(oRadio,msg);
  if(dataid != 999999999)
  {
	 var formvalues = do_it(formid); 
	 if(formvalues!='hata')
	 {
	   
		if(divid=='')
		{
		
		
		   if (!document.getElementById('foo'))
			 //alert();
			 create_foo(150,330);
			 var url=page+formvalues+'&action='+action+'&';
			 makerequest_s(url, 'foo', ''); 
			 return;  
		}
		else
		{
			
			  url=page;
			  formvalues=formvalues.substring(1,formvalues.length); 
			  var params=formvalues+'action='+action+'&';
			  //alert(divid);return;
			  makerequest_sp(url, params, divid); 
			  satirid='';
		}
		
	 }
  }

}
function  load_page_wform(page,divid,action,formid)
{
   //var s2=document.getElementById('maincontent').innerHTML= ''; 
   //var s3=document.getElementById('panel2').innerHTML= ''; 
   var formvalues = do_it(formid); 
	 if(formvalues!='hata')
	 {
	  url=page;
	  formvalues=formvalues.substring(1,formvalues.length);  
	  var params=formvalues+'action='+action+'&';
	  //var params='?action='+action+'&';
	  //alert(divid);return;
	  makerequest_sp(url, params, divid);
	 }
}

function  load_page_loading(page,divid,action)
{
  //satirid='';
  //var s2=document.getElementById('maincontent').innerHTML= ''; 
  //var s3=document.getElementById('panel2').innerHTML= ''; 
  
  //var s3=document.getElementById(divid).innerHTML= 'some text';
  url=page;
  var params='action='+action+'&';
  makerequest_sp(url, params, divid);
}

function  load_page_pagination(starting)
{
  //satirid='';
  //var s2=document.getElementById('maincontent').innerHTML= ''; 
  //var s3=document.getElementById('panel2').innerHTML= ''; 
  
  //var s3=document.getElementById(divid).innerHTML= 'some text';
  var page ='php/list_normal.php';
  var action ='listcar';
  var divid ='panelsearch';
  url=page;
  var params='action='+action+'&starting='+starting+'&';
  //alert(params);  return;
  makerequest_sp(url, params, divid);
}
function load_page_pagination2(page,divid,action,starting,str_post)
{
  url=page;
  var params='action='+action+'&starting='+starting+str_post;
  makerequest_sp(url, params, divid);
}
function clearbox(selid)
{
   // Set select to the element "selectbox."
   var select=document.getElementById(selid);
   // Set options to an array of all "option" tags that
   // are children of the select element.
   var options=select.getElementsByTagName("option");
   var i;
   // Loop through the array of options and remove each
   // each one from the parent's childNode list.
   //var len= options.length;
   //alert(options.length);return;
   for (i=0; i<options.length; i++)
   {
	  select.removeChild(options[i]);
   }// end for i
}// end clearbox

function bring_page_prcan(page,name,name2,name3,divname,action)
{
 satirid='';
 var dropdownIndex = document.getElementById(name).selectedIndex;
 var dropdownValue = document.getElementById(name)[dropdownIndex].value;
 var dropdownIndex2 = document.getElementById(name2).selectedIndex;
 var dropdownValue2 = document.getElementById(name2)[dropdownIndex2].value;
 
 var dropdownIndex3 = document.getElementById(name3).selectedIndex;
 var dropdownValue3= document.getElementById(name3)[dropdownIndex3].value;
 
 var url=page;
 var params='&action='+action+'&'+'district='+dropdownValue+'&candid='+dropdownValue2+'&province='+dropdownValue3+'&';
 makerequest_sp(url, params, divname);
 //makerequest_s(url, divname, '');
//alert(dropdownValue);return;
}

function check_availability(page,divid,input1,input2,action)
{
  var email=document.getElementById(input1).value;
 /*
  //var vip  =document.getElementById(input2).value;
  //var apos = document.getElementById(input1).value.indexOf('@');
  //var dotpos = document.getElementById(input1).value.lastIndexOf('.');
  if (apos<1||dotpos-apos<2 || document.getElementById(input1).value.length <= dotpos+1)
  {
		document.getElementById(input1).style.border = '1px solid #FF0000';
		document.getElementById(input1).focus();
		return false;
  }
  */
  if(email=='')
  {
	document.getElementById(input1).style.border = '1px solid #FF0000'; 
	document.getElementById(input1).focus();
   return;
  }
  else
  {
  var url=page;
  var params='&action='+action+'&'+'email='+email;
  //alert(params); return;
  makerequest_sp(url, params, divid); 
  }
}

function  load_page_wform_loc(page,divid,action,formid)
{
   //var s2=document.getElementById('maincontent').innerHTML= ''; 
   //var s3=document.getElementById('panel2').innerHTML= ''; 
   var formvalues = do_it(formid); 
	 if(formvalues!='hata')
	 {
	 var str=provinces_sel('SubCat'); 
	 //alert(str);return;   
	  url=page;
	  formvalues=formvalues.substring(1,formvalues.length);  
	  var params=formvalues+'action='+action+'&'+str;
	  //var params='?action='+action+'&';
	  //alert(divid);return;
	  makerequest_sp(url, params, divid);
	 }
}
function bring_page_sec(page,name,divname,action,str_post)
{
 satirid='';
 var dropdownIndex = document.getElementById(name).selectedIndex;
 var dropdownValue = document.getElementById(name)[dropdownIndex].value;
 var url=page;
 var params='&action='+action+'&'+'counter='+dropdownValue+'&'+str_post;
 //alert(params);return;
 makerequest_sp(url, params, divname);
 //makerequest_s(url, divname, '');
//alert(dropdownValue);return;
}

function show_sub(id,t)
{

	 //alert(t);return;
	  for (j=0;j<t;j++)
	  {
		 var p=document.getElementById('m'+j).style; 
		 //alert(p.display);
		 if(j==id)
		 {
			  p.display='block';
		 }
		 else
		 {
			  p.display='none';
		 }
	  }

  return;
}

function add_dist (slctbx1, slctbx2, drctn)
{
	if (drctn == '1')
	{
		var slct1 =  document.getElementById(slctbx1);
		var slct2 =  document.getElementById(slctbx2);
	}
	else if (drctn == '2')
	{
		var slct1 =  document.getElementById(slctbx2);
		var slct2 =  document.getElementById(slctbx1);
	}

	var value = slct1.options[slct1.selectedIndex].value;
	var text = slct1.options[slct1.selectedIndex].text;

	/// ekleme
	var yeni = document.createElement("option");
	yeni.value = value;
	yeni.text = text;
	yeni.selected = 'selected';

	if (slct2.options[0].text == 'No District')
	{
		slct2.removeChild(slct2.options[0]);
		slct2.options.add(yeni);
		slct2.options[0].selected = 'selected';
	}
	else if (slct2.options[0].text != 'No District' && slct1.options[0].text != 'No District')
		slct2.options.add(yeni);

	///silme                                                              
	slct1.removeChild(slct1.options[slct1.selectedIndex]);
	if (slct1.options.length == 0)
	{
		var yeni = document.createElement("option");
		yeni.value = '0';
		yeni.text = 'No District';
		slct1.options.add(yeni);
		slct1.options[0].selected = 'selected';
	}
	else
	{
		slct1.options[0].selected = "selected";
	}
}
function make_total(txb1,txtb2,rtxb)
{
  
  var tx1=eval(document.getElementById(txb1).value);
  var tx2=eval(document.getElementById(txtb2).value);
  
  var s=document.getElementById(rtxb).value=tx1+tx2; 
  return;
}
function upload(){

	var formvalues = do_it('iform'); 
	if(formvalues!='hata')
	{
	  enabdisabbtn('btn','1');
	
	  setTimeout(document.iform.submit(),5000);
	  var a = window.parent.document.getElementById('bilgi');
	  //document.iform.submit();       
	  /*
		var a = window.parent.document.getElementById('con');
		a.innerHTML = 'Please Wait...';

		setTimeout(document.iform.submit(),5000);
		var a = window.parent.document.getElementById('bilgi');
		a.innerHTML = 'Document hase been sent.';
		*/
	}
}
function popWindow(mypage){

	if( typeof( window.innerWidth ) == 'number' ) {
	//Non-IE
	myWidth = window.innerWidth;
	myHeight = window.innerHeight;
  } else if( document.documentElement && ( document.documentElement.clientWidth || document.documentElement.clientHeight ) ) {
	//IE 6+ in 'standards compliant mode'
	myWidth = document.documentElement.clientWidth;
	myHeight = document.documentElement.clientHeight;
  } else if( document.body && ( document.body.clientWidth || document.body.clientHeight ) ) {
	//IE 4 compatible
	myWidth = document.body.clientWidth;
	myHeight = document.body.clientHeight;
  }

	myWidth -= 200;

	var property = 'width = ' + myWidth + ', height = ' + myHeight + ', toolbar=no, resizable=yes';
	var yeni = window.open(mypage, 'belge', property);
	if (window.focus)
	{
		yeni.focus();
	}
}

function add_item (slctbx1, slctbx2, drctn,msg)
{
	if (drctn == '1')
	{
		var slct1 =  document.getElementById(slctbx1);
		var slct2 =  document.getElementById(slctbx2);
	}
	else if (drctn == '2')
	{
		var slct1 =  document.getElementById(slctbx2);
		var slct2 =  document.getElementById(slctbx1);
	}

	var value = slct1.options[slct1.selectedIndex].value;
	var text = slct1.options[slct1.selectedIndex].text;

	/// ekleme
	var yeni = document.createElement("option");
	yeni.value = value;
	yeni.text = text;
	yeni.selected = 'selected';

	if (slct2.options[0].text == msg)
	{
		slct2.removeChild(slct2.options[0]);
		slct2.options.add(yeni);
		slct2.options[0].selected = 'selected';
	}
	else if (slct2.options[0].text != msg && slct1.options[0].text != msg)
		slct2.options.add(yeni);

	///silme                                                              
	slct1.removeChild(slct1.options[slct1.selectedIndex]);
	if (slct1.options.length == 0)
	{
		var yeni = document.createElement("option");
		yeni.value = '0';
		yeni.text = msg;
		slct1.options.add(yeni);
		slct1.options[0].selected = 'selected';
	}
	else
	{
		slct1.options[0].selected = "selected";
	}
}
function  load_page_wform_loc2(page,divid,action,formid,scomb1,scomb2)
{
   //var s2=document.getElementById('maincontent').innerHTML= ''; 
   //var s3=document.getElementById('panel2').innerHTML= ''; 
	var formvalues = do_it(formid); 
	 if(formvalues!='hata')
	 {
	 var str=provinces_sel(scomb1); 
	 var str2=item_sel(scomb2); 
	 //alert(str);return;   
	  url=page;
	  formvalues=formvalues.substring(1,formvalues.length);  
	  var params=formvalues+'action='+action+'&'+str+'&'+str2;
	  //var params='?action='+action+'&';
	  //alert(divid);return;
	  makerequest_sp(url, params, divid);
	 }
}
function item_sel (slctbx)
{
	var selectbox = document.getElementById(slctbx);
	var str = 'lengthvillage='+selectbox.options.length;
	for (var i = 0; i < selectbox.options.length; i++)
	{
		  str += '&'+'village'+i+'='+selectbox.options[i].value;
	}        
	return str;
}

function tryDownload(page,ifid)
{
		oIFrm = document.getElementById(ifid); 
		oIFrm.src = page; 
}
function clearDivContent(id)
{
  var s3=document.getElementById(id).innerHTML= ''; 
}
function show_oneptwodiv(divid1,divid2,name)
{
  
   var dropdownIndex = document.getElementById(name).selectedIndex;
   var dropdownValue = document.getElementById(name)[dropdownIndex].value;
  
   if(dropdownValue==1)
   { 
		var dd1=document.getElementById(divid1);
		//alert(dd1);
		dd1.style.display="block";
		var dd2=document.getElementById(divid2);
		dd2.style.display="none";
   }
   else
   {
	 
		var dd2=document.getElementById(divid2);
		dd2.style.display="block";
		
		var dd1=document.getElementById(divid1);
		//alert(dd1);
		dd1.style.display="none";
		
   }
}

function  check_form_v(page,divid,action,formid,btn,msg1,msg2)
{
	 var formvalues = do_it_backn(formid); 
	 if(formvalues!='hata')
	 {
	 
	  enabdisabbtn(btn,1); 
	  url=page;
	  formvalues=formvalues.substring(1,formvalues.length);  
	  var params=formvalues+'action='+action+'&';
	  //var params='?action='+action+'&';
	  //alert(divid);return;
	  makerq_check(url, params,formid, divid,btn,msg1,msg2);
	 }
}

function enabdisabbtn(btnname,what)
{
	var btn= document.getElementById(btnname); 
	if(what == 1)
	{
		btn.disabled=true;  
	}
	else
	{
		btn.disabled=false;
		
	}
}
