
/*
*	Form Submit
*	@param : Object (ref Form)
*	@param : boolean ( true /false)
*/
function formObj_submit(formObj){
 	if( !validateForm(formObj) ){
		alert('Ji kerema xwe re ciyên sor tije bike')
		return false;
	}else{
		formObj.submit();
	}
}

function Set_Cookie( name, value, expires, path, domain, secure ) 
{
	var today = new Date();
	today.setTime( today.getTime() );

	if ( expires )
	{
		expires = expires * 1000 * 60 * 60 * 24;
	}
	var expires_date = new Date( today.getTime() + (expires) );

	document.cookie = name + "=" + escape( value ) +
		( ( expires ) ? ";expires=" + expires_date.toGMTString() : "" ) + 
		( ( path ) ? ";path=" + path : "" ) + 
		( ( domain ) ? ";domain=" + domain : "" ) +
		( ( secure ) ? ";secure" : "" );
}
function Get_Cookie( name )
{
	var start = document.cookie.indexOf( name + "=" );
	var len = start + name.length + 1;
	if ( ( !start ) && ( name != document.cookie.substring( 0, name.length ) ) )
	{
		return null;
	}
	if ( start == -1 )
		return null;
	var end = document.cookie.indexOf( ";", len );
	if ( end == -1 )
		end = document.cookie.length;
	return unescape( document.cookie.substring( len, end ) );
}
function Delete_Cookie( name, path, domain )
{
	if ( Get_Cookie( name ) )
		document.cookie = name + "=" +
			( ( path ) ? ";path=" + path : "") +
			( ( domain ) ? ";domain=" + domain : "" ) +";expires=Thu, 01-Jan-1970 00:00:01 GMT";
}
function changeTarget(elm)
{
	tmp = elm.getElementsByTagName("a");
	for(i=0; i<tmp.length; i++)
		tmp[i].target = "_blank";
}
function changeSize(elm, _size, class_name)
{
 	document.getElementById(elm).className = class_name + '_' + _size;
 	Set_Cookie('text_size', _size, 30, '', '', '');
}


function hide(id){
	document.getElementById(id).style.display='none';	
}
function show(id){
	document.getElementById(id).style.display='block';	
}
function setClass(id,className){
	document.getElementById(id).className=className;
}


function showSubMenu(parent_id,obj,s,path){
			if(parent_id==0){
				return false;
			}else{
				var grid= document.getElementById('tableGrid');
				
				subDiv= grid.getElementsByTagName('div');
				for(i=0;i<subDiv.length;i++){
					p = subDiv[i].id.split(';');
					if(p[1]==parent_id){
						if(subDiv[i].style.display=='block'){
							subDiv[i].style.display='none';
							
							subDiv2= subDiv[i].getElementsByTagName('div');
							if(subDiv2){
								for(n=0;n<subDiv2.length;n++){
									if(subDiv2[i])
										subDiv2[i].style.display ='none'
								}//end for
							}
							if(s==1){
								obj.src=path+'images/elbow-end-plus.gif'
							}else if(s==0){
								obj.src=path+'images/elbow-end-plus-nl.gif'
							}
						}else{//end if
							subDiv[i].style.display='block';
							if(s==1){
								obj.src=path+'images/elbow-minus.gif'
							}else if(s==0){
								obj.src=path+'images/elbow-end-minus-nl.gif'
							}
							
						}
						
					}
				}
			}
			
		}
 
function showList(f){
	var liste = document.getElementById('liste');
	liste.style.position='absolute';
	liste.style.width=70;
	var  a=liste.getElementsByTagName('li');
	for(i=0;i<a.length;i++){
		//a[i].style.position='absolute';
		if(f)
			a[i].style.display='block';
		else if(a[i].className!='selected')
			a[i].style.display='none';
	}
}


function post(url,data,method ,container,callback){
	
	var ajax_post = new ajax();// YENI BIR AJAX NESNESI OLUTURULDU
	ajax_post.GetData = function(urun_kodu){
 		 ajax_post.InitializeRequest('POST', url);
		 ajax_post.Commit(data);
	} // Stok bilgilerini çek
	ajax_post.OnUninit= function() {
	   displayStaticMessage('<h1>Hata </h1><p>Bar nebû dîsa bike!!</p><p><a href=\'#\' onclick=\'closeMessage();return false\'>Bigre</a>',false)
	}
	ajax_post.OnLoading = function() {
	   displayStaticMessage('<h1><img src="../images/ajax-loader.gif">Bar dibe</h1><p>Lütfen Bekleyiniz</p><p><a href=\'#\' onclick=\'closeMessage();return false\'>Bigre</a>',false)
	
	}
	ajax_post.OnLoaded = function() {
	   displayStaticMessage('<h1><img src="../images/ajax-loader.gif">Bar dibe</h1><p>Lütfen Bekleyiniz</p><p><a href=\'#\' onclick=\'closeMessage();return false\'>Bigre</a>',false)
	
	}
	ajax_post.OnInteractive    = function() {
	   displayStaticMessage('<h1><img src="../images/ajax-loader.gif">Bar dibe</h1><p>Lütfen Bekleyiniz</p><p><a href=\'#\' onclick=\'closeMessage();return false\'>Bigre</a>',false)
 	}
}
	