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();

var Browser = function() {
    agent  = navigator.userAgent.toLowerCase();
    this.major = parseInt(navigator.appVersion);
    this.minor = parseFloat(navigator.appVersion);
    this.ns    = ((agent.indexOf('mozilla')   !=   -1) &&
                 ((agent.indexOf('spoofer')   ==   -1) &&
                 (agent.indexOf('compatible') ==   -1)));
    this.ns4   = (this.ns && (this.major      ==    4));
    this.ns6   = (this.ns && (this.major      >=    5));
    this.ie    = (agent.indexOf("msie")       !=   -1);
    this.ie3   = (this.ie && (this.major      < 4));
    this.ie4   = (this.ie && (this.major      ==    4) &&
                 (agent.indexOf("msie 5.0")   ==   -1) &&
                 (agent.indexOf("msie 6.0")   ==   -1));
    this.ie5   = (this.ie && (this.major      ==    4) &&
                 (agent.indexOf("msie 5.0")   !=   -1));
    this.ie55  = (this.ie && (this.major      ==    4) &&
                 (agent.indexOf("msie 5.5")   !=   -1));
    this.ie6   = (this.ie && (agent.indexOf("msie 6.0")!=-1) );
    this.opera = (agent.indexOf("opera")      !=   -1);
    if(this.ns) {
        this.objBrowser = "Netscape";
    }
    if(this.ie) {
        this.objBrowser = "Internet Explorer";
    }
    if( this.opera) {
        this.objBrowser = "Opera";
        this.ie = false;
        this.ie5 = false;
    }
    if(this.ie4) this.version = "4.x";
    if(this.ie5) this.version = "5.0";
    if(this.ie55) this.version = "5.5";
    if(this.ie6) this.version = "6.0";
    if(this.opera) this.version = "5.x";
    if(this.ns4) this.version = "4.x";
    if(this.ns6) this.version = "6.x";
    if(this.opera) this.version = "5.x"
    if(this.ie5 || this.ie55 || this.ie6 || this.ns6 || this.opera) {
        this.dom = true;
    }
    else {
        this.dom = false;
    }
    this.info = this.objBrowser + " " + this.version + "\r\n" + this.major + "." + this.minor + "   \r\n" + agent + "  \r\n" + navigator.appVersion;
    this.objBrowser = (this.ie6 || this.ie5 || this.ns4 || this.ns6);
}

var objBrowser = new Browser();

/*
	DOMnews 1.0 
	homepage: http://www.onlinetools.org/tools/domnews/
	released 11.07.05
*/

/* Variables, go nuts changing those! */
	// initial position 
	var dn_startpos=120; 			
	// end position
	var dn_endpos=-200; 			
	// Speed of scroller higher number = slower scroller 
	var dn_speed=30;				
	// ID of the news box
	var dn_newsID='newst';			
	// class to add when JS is available
	var dn_classAdd='hasJS';		
	// Message to stop scroller
	var dn_stopMessage='Stop scroller';	
	// ID of the generated paragraph
	var dn_paraID='DOMnewsstopper';

	/* Initialise scroller when window loads */
	window.onload=function()
	{
		// check for DOM
		if(!document.getElementById || !document.createTextNode){return;}
		initDOMnews();
		// add more functions as needed
	}
	/* stop scroller when window is closed */
	window.onunload=function()
	{
		clearInterval(dn_interval);
	}

/*
	This is the functional bit, do not press any buttons or flick any switches
	without knowing what you are doing!
*/

	var dn_scrollpos=dn_startpos;
	/* Initialise scroller */
	function initDOMnews()
	{
		var n=document.getElementById(dn_newsID);
		if(!n){return;}
		n.className=dn_classAdd;
		dn_interval=setInterval('scrollDOMnews()',dn_speed);
		var newa=document.createElement('a');
		var newp=document.createElement('p');
		newp.setAttribute('id',dn_paraID);
		newa.href='#';
		newa.appendChild(document.createTextNode(dn_stopMessage));
		newa.onclick=stopDOMnews;
		newp.appendChild(newa);
		n.parentNode.insertBefore(newp,n.nextSibling);
		n.onmouseover=function()
		{		
			clearInterval(dn_interval);
		}
		n.onmouseout=function()
		{
			dn_interval=setInterval('scrollDOMnews()',dn_speed);
		}
	}

	function stopDOMnews()
	{
		clearInterval(dn_interval);
		var n=document.getElementById('news');
		n.className='';
		n.parentNode.removeChild(n.nextSibling);
		return false;
	}
	function scrollDOMnews()
	{
		var n=document.getElementById(dn_newsID).getElementsByTagName('ul')[0];
		n.style.top=dn_scrollpos+'px';	
		if(dn_scrollpos==dn_endpos){dn_scrollpos=dn_startpos;}
		dn_scrollpos--;	
	}
