if(typeof Global == "undefined") Global = new Object();

Global.JS = function() {
    
}

Global.JS.prototype = {    
    
    //PreloadImages
    PreloadImages: function() {
        if (document.images) {
            //this.NewImage(image_filename);            
        }
    },

    NewImage: function(arg) {
        if (document.images) {
            rslt = new Image();
            rslt.src = arg;
            return rslt;
        }
    },
    
    //Input
	InputOver: function(item, css) {	
	    item.className = css;
	},
	
	InputOut: function(item, css) {
		item.className = css;
	},
    
    //New Window
    NewWindow: function(Url, PageName, Width, Height, Center, Xpos, Ypos, Scrollbars, Resizable) {
        if (Center == true) {
            Xpos = (screen.availWidth-Width)/2;
            Ypos = (screen.availHeight-Height)/2;
        }
        if (Xpos == null) {Xpos = 0;}
        if (Ypos == null) {Ypos = 0;}
        if (Scrollbars == null) {Scrollbars = 0;}
        if (Resizable == null) {Resizable = 0;}
        var Features = "";
        Features += "toolbar=0" 
            + ",location=0" 
            + ",status=1" 
            + ",menubar=0" 
            + ",scrollbars=" + Scrollbars 
            + ",resizable=" + Resizable
            + ",width=" + Width 
            + ",height=" + Height
            + ",left=" + Xpos 
            + ",top=" + Ypos;
        var w = window.open(Url, PageName, Features);
        w.focus();        
    },
	
	Counter: function(item, countitem, maxlength) {
		countitem = document.getElementById(countitem);
		if (item.value.length>maxlength) {
			countitem.style.backgroundColor="#ff0000";
			countitem.style.color="#ffffff";
			item.value = item.value.substring(0, maxlength);
		}
		else {
			countitem.value = maxlength-item.value.length;	
			countitem.style.backgroundColor="#f6f6f6";
			countitem.style.color="#444444";
		}
	},
	
	ImageGallery: function(imageid, img) {
		var object = document.getElementById(imageid);
		if (objBrowser.ie) {
			object.style.filter="blendTrans(duration=1)";
			object.style.filter="blendTrans(duration=1)";
			object.filters.blendTrans.Apply();
		}
		object.src = img;
		if (objBrowser.ie) {
			object.filters.blendTrans.Play();
		}
	},
	
	AddToFavorites: function(){
		if (objBrowser.ie) {
			window.external.AddFavorite("http://www.otobusmarket.com","Otobusmarket.com");			
		}
		else { 
			alert("Kullanmış olduğunuz tarayıcı bu işlemi desteklememektedir.");			
		}
	},
	
	AjaxLoadingPanel: function(item, XoffsetLeft, YoffsetTop, center) {		
		var loading = document.getElementById("netajax_"+item);
		loading.style.display = "inline";
		if (XoffsetLeft!=null) {		
			var UpdateProgressPanel = document.getElementById(item);
			var UpdateProgressX = parseInt(netajax.offsetLeft(UpdateProgressPanel))+XoffsetLeft;
			var UpdateProgressY = parseInt(netajax.offsetTop(UpdateProgressPanel))+YoffsetTop;
			var UpdateProgressW = parseInt(UpdateProgressPanel.offsetWidth);
			var UpdateProgressH = parseInt(UpdateProgressPanel.offsetHeight); 
			if (center==true) {
				UpdateProgressX = XoffsetLeft;	
				UpdateProgressY = UpdateProgressH/2+YoffsetTop;
			}
			//Loading Panel	
			loading.style.left = UpdateProgressX;
			loading.style.top = UpdateProgressY;
			loading.style.width = UpdateProgressW-2;
			loading.style.height = UpdateProgressH-2;	
			//Loading Image
			var loading_img = document.getElementById("netajax_img_"+UpdateProgressPanel.id);
			loading_img.style.paddingTop = parseInt((UpdateProgressH-loading_img.height)/2);
		}
	},
	
	AjaxDoneloadingPanel: function(item) {
		var loading = document.getElementById("netajax_"+item);
		loading.style.display = "none";
	}
    
}

var JS = Global.JS;
var objJS = new JS();