if (!window.Rotator) Rotator = {}; Rotator.Page = function() { } Rotator.Page.prototype = { handleLoad: function(control, userContext, rootElement) { this.control = control; // Sample event hookup: rootElement.addEventListener("MouseLeftButtonDown", Silverlight.createDelegate(this, this.handleMouseDown)); }, // Sample event handler handleMouseDown: function(sender, eventArgs) { // The following line of code shows how to find an element by name and call a method on it. // this.control.content.findName("Storyboard1").Begin(); } } /* = = = = = = = = = wlasny kod = =*/ //wyznacamy promienie elipsy a=200 b=20 var a = 200; var b = 10; //ilosc buttonów var btnCount = 1; //odstepy miedzy buttonami var margin = 360/btnCount; var control; var maxindex = btnCount; function get_buttons() { control = document.getElementById("SilverlightControl"); //control.content.findName("btn1"); var i=1; while(control.content.findName("trbtn" + i)) { i++; } i--; btnCount = i; margin = 360/btnCount; maxindex = btnCount; //alert('btnCount='+btnCount); setposition(); } function setposition() { var degree = 0; var rad = 0; for(var i=1; i<=btnCount; i++) { rad = degree*Math.PI/180; control.content.findName("trbtn"+i).X = a*Math.cos(rad) control.content.findName("trbtn"+i).Y = b*Math.sin(rad) control.content.findName("s"+i+"btn")["Canvas.ZIndex"] = i; degree -= margin; } movebuttons(); } var slow = false; var deg = 0; function movebuttons() { if(!slow) { if(deg == 360) {deg = 0} var degree=0; for(var i=1; i < btnCount+1; i++) { if(control.content.findName("trbtn"+i)) /*zeby nie bylo zonka jak nie bedzie */ { degree = deg - i*margin; rad = (degree*Math.PI)/180; control.content.findName("trbtn"+i).X = a*Math.cos(rad) + 20; control.content.findName("trbtn"+i).Y = b*Math.sin(rad); var size = Math.abs(Math.sin(rad/2+Math.PI/4)); if(size < 0.05) {size = 0.05;} control.content.findName("scbtn"+i).ScaleX = size; control.content.findName("scbtn"+i).ScaleY = size; //control.content.findName("degtxt").Text = "s"+i+"btn "+ control.content.findName("s"+i+"btn")["Canvas.ZIndex"] + "tsizen "+tsize; if((degree==16)||(degree==-344)) { if(maxindex > control.content.findName("s"+i+"btn")["Canvas.ZIndex"]) { //control.content.findName("degtxt").Text = "s"+i+"btn "+ control.content.findName("s"+i+"btn")["Canvas.ZIndex"] +" deg "+degree ; control.content.findName("s"+i+"btn")["Canvas.ZIndex"] +=btnCount; maxindex = control.content.findName("s"+i+"btn")["Canvas.ZIndex"]; } //alert("s"+i+"btn "+ control.content.findName("s"+i+"btn")["Canvas.ZIndex"]); } if(slow) break; } } deg++; } if(!slow) { setTimeout("movebuttons()", 30); } } function SlowDwon(sender, MouseEventArgs) { var name = sender.Name.replace("btn","txt"); //alert(name); control.content.findName(name).Foreground = "#ffff9900"; slow = true; } function RunAgain(sender, MouseEventArgs) { if(slow) { slow = false; var name = sender.Name.replace("btn","txt"); //alert(name); control.content.findName(name).Foreground = "#ffffffff"; //var name = sender.Name.replace("btn","btnLeave"); //control.content.findName("LogoFadeIn").Begin(); movebuttons(); //control.content.findName(name).Begin(); } } function OnClick(sender, MouseEventArgs) { var txtname = sender.Name.replace("btn","txt"); //alert(name); control.content.findName(txtname).Foreground = "#ffff0000"; var text = control.content.findName(txtname).Text; var group = ""; var locationUrl = ''; locationUrl = new String(window.location); var prod_id = 0; if(locationUrl.indexOf('PRO') > 0) { group = "&ptype=PRO"; } else if(locationUrl.indexOf('GRY') > 0) { group = "&ptype=GRY"; } else if(locationUrl.indexOf('OFF') > 0) { group = "&ptype=OFF"; } var param; if("Seria" == text.match("Seria")) { param = '?series_acro='+text.replace("Seria ", ""); } else { prod_id = control.content.findName(sender.Name.replace("btn","_prod")).Text; param = "?product_id=" + prod_id; } var adres = locationUrl.substring(0,locationUrl.indexOf("?")); if((adres =="")||(adres[adres.length-1]=='/')) { adres = adres + 'nl_cat.php'; } //alert(adres + param + group); window.location = adres + param + group; } function OpenGallery(product_id, photo_id) { window.open('/gallery.php?product_id='+product_id+'=&photoid='+photo_id,'_blank', 'left=20,top=20,width=700,height=700,toolbar=0,resizable=0,location=no'); }